module Omnium::Lexer::TokenHelper
Public Class Methods
define_new_token_method(type, value, arity = 0)
click to toggle source
# File lib/omnium/lexer/token_helper.rb, line 8 def define_new_token_method(type, value, arity = 0) method_name = "new_#{type}_token" if arity == 0 define_method(method_name) { Token.new(type, value) } else define_method(method_name) { |argument| Token.new(type, argument) } end end
Private Instance Methods
define_new_token_method(type, value, arity = 0)
click to toggle source
# File lib/omnium/lexer/token_helper.rb, line 8 def define_new_token_method(type, value, arity = 0) method_name = "new_#{type}_token" if arity == 0 define_method(method_name) { Token.new(type, value) } else define_method(method_name) { |argument| Token.new(type, argument) } end end