summaryrefslogtreecommitdiff
path: root/lib/chef/event_dispatch
diff options
context:
space:
mode:
authorXabier de Zuazo <xabier@onddo.com>2014-11-27 22:44:10 +0100
committerLamont Granquist <lamont@scriptkiddie.org>2015-01-27 11:59:40 -0800
commit8b4b26b6858e681a6d9d1c65abd7f97f68ee42c1 (patch)
tree456517466a8e2d5a63ac812cada43b5275b3f30e /lib/chef/event_dispatch
parent9e6a0cdda93de380093c4abdfeb563d6f946223b (diff)
downloadchef-8b4b26b6858e681a6d9d1c65abd7f97f68ee42c1.tar.gz
Use #define_method instead of #class_eval (ruby 1.8 specific, issue #2497)
Diffstat (limited to 'lib/chef/event_dispatch')
-rw-r--r--lib/chef/event_dispatch/dispatcher.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/chef/event_dispatch/dispatcher.rb b/lib/chef/event_dispatch/dispatcher.rb
index c172a406d8..9f43f14311 100644
--- a/lib/chef/event_dispatch/dispatcher.rb
+++ b/lib/chef/event_dispatch/dispatcher.rb
@@ -25,11 +25,9 @@ class Chef
# Define a method that will be forwarded to all
def self.def_forwarding_method(method_name)
- class_eval(<<-END_OF_METHOD, __FILE__, __LINE__)
- def #{method_name}(*args)
- @subscribers.each {|s| s.#{method_name}(*args)}
- end
- END_OF_METHOD
+ define_method(method_name) do |*args|
+ @subscribers.each { |s| s.send(method_name, *args) }
+ end
end
(Base.instance_methods - Object.instance_methods).each do |method_name|