Class: Monadist::Identity
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #bind(&block) ⇒ Object
-
#initialize(value) ⇒ Identity
constructor
A new instance of Identity.
Methods inherited from Monad
Constructor Details
#initialize(value) ⇒ Identity
Returns a new instance of Identity.
8 9 10 |
# File 'lib/monadist/identity.rb', line 8 def initialize(value) @value = value end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Monadist::Monad
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/monadist/identity.rb', line 4 def value @value end |
Class Method Details
.unit(value) ⇒ Object
20 21 22 |
# File 'lib/monadist/identity.rb', line 20 def self.unit(value) new value end |
Instance Method Details
#bind(&block) ⇒ Object
14 15 16 |
# File 'lib/monadist/identity.rb', line 14 def bind(&block) block.call value end |