Class: Keisan::Interpreter
- Inherits:
-
Object
- Object
- Keisan::Interpreter
- Defined in:
- lib/keisan/interpreter.rb
Instance Attribute Summary collapse
-
#calculator ⇒ Object
readonly
Returns the value of attribute calculator.
Instance Method Summary collapse
-
#initialize(allow_recursive: false) ⇒ Interpreter
constructor
A new instance of Interpreter.
- #run(file_name) ⇒ Object
Constructor Details
#initialize(allow_recursive: false) ⇒ Interpreter
Returns a new instance of Interpreter.
7 8 9 |
# File 'lib/keisan/interpreter.rb', line 7 def initialize(allow_recursive: false) @calculator = Calculator.new(allow_recursive: allow_recursive) end |
Instance Attribute Details
#calculator ⇒ Object (readonly)
Returns the value of attribute calculator.
5 6 7 |
# File 'lib/keisan/interpreter.rb', line 5 def calculator @calculator end |
Instance Method Details
#run(file_name) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/keisan/interpreter.rb', line 11 def run(file_name) if file_name.nil? run_from_stdin else run_from_file(file_name) end end |