Class: Functional::Some

Inherits:
Option show all
Defined in:
lib/maybe.rb

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Some

Returns a new instance of Some.



120
121
122
# File 'lib/maybe.rb', line 120

def initialize(value)
  @value = value
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *args, &block) ⇒ Object



132
133
134
# File 'lib/maybe.rb', line 132

def method_missing(method_sym, *args, &block)
  map { |value| value.send(method_sym, *args, &block) }
end

Instance Method Details

#getObject



124
125
126
# File 'lib/maybe.rb', line 124

def get
  value
end

#or_elseObject



128
129
130
# File 'lib/maybe.rb', line 128

def or_else(*)
  value
end