Class: Object

Inherits:
BasicObject
Defined in:
lib/maybe_fun/object.rb

Instance Method Summary collapse

Instance Method Details

#doObject Also known as: unless_null, also



2
3
4
5
# File 'lib/maybe_fun/object.rb', line 2

def do
  yield unless nil?
  self
end

#if_nillObject



10
11
12
13
# File 'lib/maybe_fun/object.rb', line 10

def if_nill
  yield if nil?
  self
end

#with(&block) ⇒ Object



15
16
17
18
# File 'lib/maybe_fun/object.rb', line 15

def with(&block)
  return self if nil?
  block.call(self)
end