Class: Ramda::Internal::Functors::Identity

Inherits:
Object
  • Object
show all
Defined in:
lib/ramda/internal/functors.rb

Overview

‘Identity` is a functor that holds a single value, where `map` simply transforms the held value with the provided function.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



26
27
28
# File 'lib/ramda/internal/functors.rb', line 26

def value
  @value
end

Class Method Details

.of(x) ⇒ Object



28
29
30
# File 'lib/ramda/internal/functors.rb', line 28

def self.of(x)
  new(x)
end

Instance Method Details

#map(f) ⇒ Object



32
33
34
# File 'lib/ramda/internal/functors.rb', line 32

def map(f)
  Identity.of(f.call(@value))
end