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
8
# File 'lib/crapshoot/tokens/constant.rb', line 4

def initialize(number)
  @value = Result.new number.to_i
  @value.description = @value.to_s
  @value.detailed_description = [[@value.to_s, @value.to_s]]
end

Instance Method Details

#eval(stack) ⇒ Object



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

def eval(stack)
  return @value
end

#inspectObject



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

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