Class: DTRToRust::Common::InputInterpreter
- Inherits:
-
Object
- Object
- DTRToRust::Common::InputInterpreter
- Defined in:
- lib/common/input_interpreter.rb
Overview
This class is responsible for interpreting the input string.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(input) ⇒ InputInterpreter
constructor
A new instance of InputInterpreter.
- #interpret ⇒ Object
Constructor Details
#initialize(input) ⇒ InputInterpreter
7 8 9 |
# File 'lib/common/input_interpreter.rb', line 7 def initialize(input) @input = input end |
Class Method Details
.interpret(input) ⇒ Object
11 12 13 |
# File 'lib/common/input_interpreter.rb', line 11 def self.interpret(input) new(input).interpret end |
Instance Method Details
#interpret ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/common/input_interpreter.rb', line 15 def interpret if number?(@input) number_return(@input) elsif string?(@input) string_return(@input) else variable_return(@input) end end |