Class: Cambridge::Tokens::Number
- Defined in:
- lib/cambridge/tokens/number.rb
Instance Method Summary collapse
-
#initialize(string) ⇒ Number
constructor
A new instance of Number.
- #to_ruby ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(string) ⇒ Number
Returns a new instance of Number.
4 5 6 |
# File 'lib/cambridge/tokens/number.rb', line 4 def initialize(string) @number = de_codepoint(string).to_i end |
Instance Method Details
#to_ruby ⇒ Object
8 9 10 |
# File 'lib/cambridge/tokens/number.rb', line 8 def to_ruby "@stack.push #{@number.to_s}" end |