module Bendy::Logical
Some logical methods
Public Instance Methods
implies(antecedent) { |: true| ... }
click to toggle source
@!method implies(antecedent){ consequent } #=> true or consequent
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:
@example Extract the bar value given foo exists
implies(foo){foo[:bar]}
# File lib/bendy/logical.rb, line 16 def implies(antecedent) !!antecedent ? yield : true end