Module: Datacraft::Parser

Included in:
Datacraft
Defined in:
lib/datacraft/parser.rb

Instance Method Summary collapse

Instance Method Details

#parse(script = nil, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/datacraft/parser.rb', line 3

def parse(script = nil, &block)
  instruction = Instruction.new
  if script
    instruction.instance_eval(script)
  else
    instruction.instance_eval(&block)
  end
  instruction.validate
  instruction
end