1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

ripper/lexer.rb: dispatch alias

* ext/ripper/lib/ripper/lexer.rb: alias same methods instead of
  eval for each events.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-11-28 06:56:23 +00:00
parent cf2b422fc5
commit ef44c0ad2f

View file

@ -60,12 +60,12 @@ class Ripper
private
def _push_token(tok)
@buf.push [[lineno(), column()], __callee__, tok]
end
SCANNER_EVENTS.each do |event|
module_eval(<<-End, __FILE__+'/module_eval', __LINE__ + 1)
def on_#{event}(tok)
@buf.push [[lineno(), column()], :on_#{event}, tok]
end
End
alias_method "on_#{event}", :_push_token
end
end