Module: Kiba::Parser
- Included in:
- Kiba
- Defined in:
- lib/kiba/parser.rb
Instance Method Summary collapse
Instance Method Details
#parse(source_as_string = nil, source_file = nil, &source_as_block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/kiba/parser.rb', line 3 def parse(source_as_string = nil, source_file = nil, &source_as_block) control = Control.new context = Context.new(control) if source_as_string # this somewhat weird construct allows to remove a nil source_file context.instance_eval(*[source_as_string, source_file].compact) else context.instance_eval(&source_as_block) end control end |