Class: Optiomist::Some
- Inherits:
-
Object
- Object
- Optiomist::Some
- Defined in:
- lib/optiomist.rb
Overview
There is some value. Warning: nil
is also treated as a correct value.
Example:
>> result = Optiomist.some('x')
>> result.some?
=> true
>> result.value
=> 'x'
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
This is the value.
Instance Method Summary collapse
-
#initialize(value) ⇒ Some
constructor
A new instance of Some.
-
#none? ⇒ Boolean
It’s
false
. -
#some? ⇒ Boolean
It’s
true
.
Constructor Details
#initialize(value) ⇒ Some
Returns a new instance of Some.
20 21 22 |
# File 'lib/optiomist.rb', line 20 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
This is the value.
18 19 20 |
# File 'lib/optiomist.rb', line 18 def value @value end |
Instance Method Details
#none? ⇒ Boolean
It’s false
.
30 31 32 |
# File 'lib/optiomist.rb', line 30 def none? false end |
#some? ⇒ Boolean
It’s true
.
25 26 27 |
# File 'lib/optiomist.rb', line 25 def some? true end |