Class: Dappgen::Interpreter
- Inherits:
-
Object
- Object
- Dappgen::Interpreter
- Defined in:
- lib/dappgen/interpreter.rb
Instance Method Summary collapse
- #built_script ⇒ Object
-
#initialize(script, machine) ⇒ Interpreter
constructor
A new instance of Interpreter.
- #run! ⇒ Object
Constructor Details
#initialize(script, machine) ⇒ Interpreter
Returns a new instance of Interpreter.
5 6 7 8 |
# File 'lib/dappgen/interpreter.rb', line 5 def initialize(script, machine) @script = script @machine = machine end |
Instance Method Details
#built_script ⇒ Object
10 11 12 |
# File 'lib/dappgen/interpreter.rb', line 10 def built_script @built_script ||= @script.built_script end |
#run! ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dappgen/interpreter.rb', line 14 def run! built_script.each do |statement| args = [ statement.first.first, statement.first[1] ] = statement.to_a[1..-1].to_h args << unless .empty? @machine.public_send(*args) end end |