Class: Functional::None

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

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missingObject



105
106
107
# File 'lib/maybe.rb', line 105

def method_missing(*)
  self
end

Instance Method Details

#getObject



97
98
99
# File 'lib/maybe.rb', line 97

def get
  fail 'No such element'
end

#or_else(default = nil) ⇒ Object



101
102
103
# File 'lib/maybe.rb', line 101

def or_else(default = nil)
  block_given? ? yield : default
end