define_method_handler 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ 0.0.6 Making tests pass for ruby 1.8
2
+
1
3
  0.0.5 added error handling on remove_method
2
4
 
3
5
  refactor: changed state variables of chain to changes to allow keeping state of multiple methods by nam
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require "rspec/core/rake_task"
7
7
 
8
8
  spec = Gem::Specification.new do |s|
9
9
  s.name = 'define_method_handler'
10
- s.version = '0.0.5'
10
+ s.version = '0.0.6'
11
11
  s.author = 'Dario Seminara'
12
12
  s.email = 'robertodarioseminara@gmail.com'
13
13
  s.platform = Gem::Platform::RUBY
@@ -144,6 +144,7 @@ class Class
144
144
  }
145
145
 
146
146
  define_method(mname) do |*x, &callblk|
147
+ retval = nil
147
148
  self.class.method_handlers[mname].reject{|mhh|
148
149
  mhh.group.count { |gr|
149
150
  @disabled_handler_groups ||= Hash.new
@@ -157,12 +158,14 @@ class Class
157
158
 
158
159
  begin
159
160
  if mhh.method_name
160
- return send(mhh.method_name, *x, &callblk)
161
+ retval = send(mhh.method_name, *x, &callblk)
162
+ break
161
163
  else
162
164
  self.class.class_eval do
163
165
  define_method(tmp_method, &mhh.processor)
164
166
  end
165
- return method(tmp_method).call(*x, &callblk)
167
+ retval = method(tmp_method).call(*x, &callblk)
168
+ break
166
169
  end
167
170
  ensure
168
171
  unless mhh.method_name
@@ -177,7 +180,7 @@ class Class
177
180
  end
178
181
  end
179
182
 
180
- nil
183
+ retval
181
184
  end
182
185
 
183
186
  mh
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: define_method_handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-29 00:00:00.000000000Z
12
+ date: 2012-04-22 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Chain of responsability implementation in a ruby fashion way. See README
15
15
  for examples