mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ripper/dummyparser.rb: suppress redefinition warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9603cd2f62
commit
2957020491
1 changed files with 6 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue