summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-03 12:25:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-03 12:25:32 +0000
commit2957020491557bbf4c4aba2432f1b11581b0f4ab (patch)
tree06f04dbe62b64b1f638144a22dd1fd75b62cfd66 /test
parent9603cd2f627013d50a40419e2283752346a15c99 (diff)
* test/ripper/dummyparser.rb: suppress redefinition warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ripper/dummyparser.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/test/ripper/dummyparser.rb b/test/ripper/dummyparser.rb
index 2c107b37c28..cf0b5d2a30b 100644
--- a/test/ripper/dummyparser.rb
+++ b/test/ripper/dummyparser.rb
@@ -47,13 +47,6 @@ class NodeList
end
class DummyParser < Ripper
- Ripper::PARSER_EVENTS.each do |event|
- event = event.to_s
- define_method(:"on_#{event}") do |*args|
- Node.new(event, *args)
- end
- end
-
def hook(name)
class << self; self; end.class_eval do
define_method(name) do |*a, &b|
@@ -188,4 +181,10 @@ class DummyParser < Ripper
def on_assoclist_from_args(a)
Node.new('assocs', *a.list)
end
+
+ (Ripper::PARSER_EVENTS.map(&:to_s) - instance_methods(false).map {|n|n.to_s.sub(/^on_/, '')}).each do |event|
+ define_method(:"on_#{event}") do |*args|
+ Node.new(event, *args)
+ end
+ end
end