Class: Ramda::Internal::Functors::Maybe::Some
- Inherits:
-
Object
- Object
- Ramda::Internal::Functors::Maybe::Some
- Defined in:
- lib/ramda/internal/functors.rb
Overview
Some value
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #ap(m) ⇒ Object
- #chain(f) ⇒ Object
-
#initialize(value) ⇒ Some
constructor
A new instance of Some.
- #map(f) ⇒ Object
- #none? ⇒ Boolean
- #some? ⇒ Boolean
Constructor Details
#initialize(value) ⇒ Some
Returns a new instance of Some.
57 58 59 |
# File 'lib/ramda/internal/functors.rb', line 57 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
55 56 57 |
# File 'lib/ramda/internal/functors.rb', line 55 def value @value end |
Instance Method Details
#==(other) ⇒ Object
61 62 63 |
# File 'lib/ramda/internal/functors.rb', line 61 def ==(other) instance_of?(other.class) && value == other.value end |
#ap(m) ⇒ Object
65 66 67 |
# File 'lib/ramda/internal/functors.rb', line 65 def ap(m) m.map(@value) end |
#chain(f) ⇒ Object
69 70 71 |
# File 'lib/ramda/internal/functors.rb', line 69 def chain(f) f.call(@value) end |
#map(f) ⇒ Object
73 74 75 |
# File 'lib/ramda/internal/functors.rb', line 73 def map(f) Maybe.of(f.call(@value)) end |
#none? ⇒ Boolean
77 78 79 |
# File 'lib/ramda/internal/functors.rb', line 77 def none? false end |
#some? ⇒ Boolean
81 82 83 |
# File 'lib/ramda/internal/functors.rb', line 81 def some? true end |