Class: Ramda::Internal::Functors::Maybe::Some

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

Overview

Some value

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#valueObject (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

Returns:

  • (Boolean)


77
78
79
# File 'lib/ramda/internal/functors.rb', line 77

def none?
  false
end

#some?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/ramda/internal/functors.rb', line 81

def some?
  true
end