Class: Crapshoot::Tokens::Constant

Inherits:
Base
  • Object
show all
Defined in:
lib/crapshoot/tokens/constant.rb

Instance Method Summary collapse

Methods inherited from Base

#independent, #precedent

Constructor Details

#initialize(number) ⇒ Constant

Returns a new instance of Constant.



4
5
6
7
# File 'lib/crapshoot/tokens/constant.rb', line 4

def initialize(number)
  @value = Result.new number.to_i
  @value.description = @value.to_s
end

Instance Method Details

#eval(stack) ⇒ Object



9
10
11
# File 'lib/crapshoot/tokens/constant.rb', line 9

def eval(stack)
  return @value
end

#inspectObject



13
14
15
# File 'lib/crapshoot/tokens/constant.rb', line 13

def inspect
  "<Crapshoot::Tokens::Constant value=#{@value}>"
end