Class: Speq::SomeValue
- Inherits:
-
Object
- Object
- Speq::SomeValue
- Defined in:
- lib/speq/values.rb,
lib/speq/string_fmt.rb
Overview
Holds any value allowing for a distiction between Some(nil) and None
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, description = nil) ⇒ SomeValue
constructor
A new instance of SomeValue.
- #to_s ⇒ Object
Constructor Details
#initialize(value, description = nil) ⇒ SomeValue
Returns a new instance of SomeValue.
74 75 76 77 |
# File 'lib/speq/values.rb', line 74 def initialize(value, description = nil) @value = value @description = description end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
72 73 74 |
# File 'lib/speq/values.rb', line 72 def description @description end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
71 72 73 |
# File 'lib/speq/values.rb', line 71 def value @value end |
Instance Method Details
#to_s ⇒ Object
73 74 75 |
# File 'lib/speq/string_fmt.rb', line 73 def to_s description || value.inspect end |