Class: Literal::IntegerValue
- Defined in:
- lib/literal/integer_value.rb
Instance Attribute Summary
Attributes inherited from Value
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(value) ⇒ IntegerValue
constructor
A new instance of IntegerValue.
Methods inherited from Value
Constructor Details
#initialize(value) ⇒ IntegerValue
Returns a new instance of IntegerValue.
4 5 6 7 8 9 10 11 12 |
# File 'lib/literal/integer_value.rb', line 4 def initialize(value) unless Integer === value raise Literal::TypeError.expected(value, to_be_a: Integer) end @value = value freeze end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/literal/integer_value.rb', line 16 def ==(other) case other when Integer @value == other when Literal::IntegerValue @value == other.value else false end end |