Class: Kalc::Ast::Commands
- Inherits:
-
Object
- Object
- Kalc::Ast::Commands
- Defined in:
- lib/kalc/ast.rb
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
Instance Method Summary collapse
- #eval(context) ⇒ Object
-
#initialize(commands) ⇒ Commands
constructor
A new instance of Commands.
Constructor Details
#initialize(commands) ⇒ Commands
Returns a new instance of Commands.
7 8 9 |
# File 'lib/kalc/ast.rb', line 7 def initialize(commands) @commands = commands end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
5 6 7 |
# File 'lib/kalc/ast.rb', line 5 def commands @commands end |
Instance Method Details
#eval(context) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/kalc/ast.rb', line 11 def eval(context) last = nil @commands.each do |command| last = command.eval(context) end last end |