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.
6 7 8 |
# File 'lib/kalc/ast.rb', line 6 def initialize(commands) @commands = commands end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
4 5 6 |
# File 'lib/kalc/ast.rb', line 4 def commands @commands end |
Instance Method Details
#eval(context) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/kalc/ast.rb', line 10 def eval(context) last = nil @commands.each do |command| last = command.eval(context) end last end |