Module: B001e::Truthiness

Included in:
Extensions::Core::ObjectExtensions, Extensions::Core::TrueClassExtensions
Defined in:
lib/b001e/truthiness.rb

Instance Method Summary collapse

Instance Method Details

#andObject



23
24
25
# File 'lib/b001e/truthiness.rb', line 23

def and
  yield
end

#ifObject



8
9
10
# File 'lib/b001e/truthiness.rb', line 8

def if
  yield
end

#ifelse(then_branch = ->{}, _ = nil) ⇒ Object



12
13
14
# File 'lib/b001e/truthiness.rb', line 12

def ifelse then_branch = ->{}, _ = nil
  then_branch.()
end

#notObject



31
32
33
# File 'lib/b001e/truthiness.rb', line 31

def not
  false
end

#orObject



27
28
29
# File 'lib/b001e/truthiness.rb', line 27

def or
  self
end

#unlessObject



16
17
# File 'lib/b001e/truthiness.rb', line 16

def unless
end

#unlesselse(_ = nil, else_branch = ->{}) ⇒ Object



19
20
21
# File 'lib/b001e/truthiness.rb', line 19

def unlesselse _ = nil, else_branch = ->{}
  ifelse else_branch, _
end