Method: EBNF::PEG::Parser::ClassMethods#eval_with_binding

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

#eval_with_binding(object) ⇒ Object

Evaluate a handler, delegating to the specified object. This is necessary so that handlers can operate within the binding context of the parser in which they’re invoked.

Parameters:

  • object (Object)

Returns:

  • (Object)


153
154
155
156
# File 'lib/ebnf/peg/parser.rb', line 153

def eval_with_binding(object)
  @delegate = object
  object.instance_eval {yield}
end