durable_decorator 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3e1805f190bf24664f050b50a1a13e7adfb10040
4
+ data.tar.gz: 0bd802b5280e690b84a6e793ac5c8e749dc6957f
5
+ SHA512:
6
+ metadata.gz: d66aa3613cae0ef62f0dc525d2ab1f8f8ba6f669d1f81cf0f8332954b19067c08c8152a6d9f24362537868da3ad501b76b609ad69fb68927d0a1da2e0086077f
7
+ data.tar.gz: d5c4019e69c3f87d94212997716c5de83a191f29445f7a20460b161702d1049832c97755ba77650cfadbd0197f0f1a26545fe0806a7e7edeba1929863ea2b123
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
-
5
- gem 'rspec'
data/README.md CHANGED
@@ -30,6 +30,8 @@ Prior to Version 0.2.0 original methods would have a suffix of original or SHA.
30
30
  use prefix rather than suffix in order to be compatible with example! and example? methods. Please review your durably decorated
31
31
  methods when upgrading to Version 0.2.0.
32
32
 
33
+ Versions >= 0.2.0 are not tested on Rubies < 1.9.2. Please use version 0.1.2 if you absolutely need Ruby 1.8.7 compatibility.
34
+
33
35
  ## Usage
34
36
 
35
37
  ```ruby
@@ -29,7 +29,7 @@ module DurableDecorator
29
29
 
30
30
  # Ensure method exists before creating new definitions
31
31
  def existing_method clazz, method_name, meta, &block
32
- return if redefined? clazz, method_name, &block
32
+ return if redefined?(clazz, method_name, &block)
33
33
 
34
34
  old_method = Validator.validate_existing_definition clazz, method_name
35
35
  Validator.validate_method_arity clazz, method_name, old_method, &block
@@ -85,14 +85,9 @@ module DurableDecorator
85
85
  end
86
86
 
87
87
  def redefined? clazz, method_name, &block
88
- begin
89
- result =
90
- overrides = DEFINITIONS[clazz][method_name] and
91
- overrides.select{|o| o == Util.method_hash(method_name)}.first and
92
- true
93
- rescue
94
- false
95
- end
88
+ full_name = Util.full_method_name(clazz, method_name)
89
+ redefs = DEFINITIONS[full_name] and
90
+ redefs.include? Util.method_hash(method_name, block)
96
91
  end
97
92
 
98
93
  def determine_sha target
@@ -1,3 +1,3 @@
1
1
  module DurableDecorator
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -39,6 +39,19 @@ describe DurableDecorator::Base do
39
39
  end
40
40
  end
41
41
 
42
+ context 'for re-run decorations' do
43
+ it 'does not create a new redefinition' do
44
+ 2.times {
45
+ ExampleClass.class_eval do
46
+ durably_decorate :no_param_method do
47
+ original_no_param_method + " and a new string"
48
+ end
49
+ end
50
+ }
51
+ DurableDecorator::Base.definitions['ExampleClass#no_param_method'].size.should == 2 # original definition and one deoration
52
+ end
53
+ end
54
+
42
55
  context 'for double decorations' do
43
56
  before do
44
57
  ExampleClass.class_eval do
metadata CHANGED
@@ -1,52 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: durable_decorator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
- prerelease:
4
+ version: 0.2.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Denis Ivanov
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-09 00:00:00.000000000 Z
11
+ date: 2013-09-28 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: method_source
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: logging
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: bundler
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,33 +55,29 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rspec
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  description: Allows method redefinitions while maintaining *super*
@@ -124,27 +113,26 @@ files:
124
113
  homepage: https://github.com/jumph4x/durable-decorator
125
114
  licenses:
126
115
  - MIT
116
+ metadata: {}
127
117
  post_install_message:
128
118
  rdoc_options: []
129
119
  require_paths:
130
120
  - lib
131
121
  required_ruby_version: !ruby/object:Gem::Requirement
132
- none: false
133
122
  requirements:
134
- - - ! '>='
123
+ - - '>='
135
124
  - !ruby/object:Gem::Version
136
125
  version: 1.9.2
137
126
  required_rubygems_version: !ruby/object:Gem::Requirement
138
- none: false
139
127
  requirements:
140
- - - ! '>='
128
+ - - '>='
141
129
  - !ruby/object:Gem::Version
142
130
  version: '0'
143
131
  requirements: []
144
132
  rubyforge_project:
145
- rubygems_version: 1.8.25
133
+ rubygems_version: 2.0.3
146
134
  signing_key:
147
- specification_version: 3
135
+ specification_version: 4
148
136
  summary: Allows method redefinitions while maintaining *super*
149
137
  test_files:
150
138
  - spec/durable_decorator_spec.rb