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