Module: Bendy::Logical

Defined in:
lib/bendy/logical.rb

Overview

Some logical methods

Instance Method Summary collapse

Instance Method Details

#implies(antecedent) ⇒ Object

Material implication

implies is the common case where if the first thing is true (antecedent), then pay attention to the second thing (consequent). But if the first thing is false then the whole thing is true:

Examples:

Extract the bar value given foo exists

implies(foo){foo[:bar]}


16
17
18
# File 'lib/bendy/logical.rb', line 16

def implies(antecedent)
  !!antecedent ? yield : true
end