Method: EBNF::PEG::Parser::ClassMethods#method_missing

Defined in:
lib/ebnf/peg/parser.rb

#method_missing(method, *args, &block) ⇒ Object (private)



160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/ebnf/peg/parser.rb', line 160

def method_missing(method, *args, &block)
  if @delegate ||= nil
    # special handling when last arg is **options
    params = @delegate.method(method).parameters
    if params.any? {|t, _| t == :keyrest} && args.last.is_a?(Hash)
      opts = args.pop
      @delegate.send(method, *args, **opts, &block)
    else
      @delegate.send(method, *args, &block)
    end
  else
    super
  end
end