Class: Spiel::Just

Inherits:
Object
  • Object
show all
Defined in:
lib/spiel/maybe.rb

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Just

Returns a new instance of Just.



5
6
7
# File 'lib/spiel/maybe.rb', line 5

def initialize(object)
  @object = object
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



9
10
11
# File 'lib/spiel/maybe.rb', line 9

def method_missing(meth, *args, &block)
  Maybe(@object.send(meth, *args, &block))
end

Instance Method Details

#get_or_else(value) ⇒ Object



13
14
15
# File 'lib/spiel/maybe.rb', line 13

def get_or_else(value)
  @object
end