Module: NoConditionals::Falseyness

Defined in:
lib/no_conditionals.rb

Overview

Mixin for falsey behavior

Instance Method Summary collapse

Instance Method Details

#henceObject

just returns object, ignores block



34
35
36
# File 'lib/no_conditionals.rb', line 34

def hence
  self
end

#maybe(so, maybe: self) ⇒ Object

ignores first parameter (so), returns either object or keyword argument (maybe)



44
45
46
# File 'lib/no_conditionals.rb', line 44

def maybe so, maybe: self
  maybe
end

#maybe!(so, maybe: -> { self }) ⇒ Object

calls keyword argument (maybe) or nothing



49
50
51
# File 'lib/no_conditionals.rb', line 49

def maybe! so, maybe: -> { self }
  maybe.call
end

#otherwise {|_self| ... } ⇒ Object

evaluates a block

Yields:

  • (_self)

Yield Parameters:



39
40
41
# File 'lib/no_conditionals.rb', line 39

def otherwise
  yield self
end