Module: CustomBoolean::Operators
- Defined in:
- lib/custom_boolean.rb
Instance Method Summary collapse
-
#&(other) ⇒ Boolean
(also: #and)
Equivalent of *&&* for CustomBoolean truthiness.
-
#|(other) ⇒ Boolean
(also: #or)
Equivalent of *||* for CustomBoolean truthiness.
Instance Method Details
#&(other) ⇒ Boolean Also known as: and
Equivalent of *&&* for CustomBoolean truthiness. Differs from regular *&&* as it uses CustomBoolean truthiness
NOTE: It is usually better to use the #and alias, as fewer objects override this method)
22 23 24 |
# File 'lib/custom_boolean.rb', line 22 def &(other) CustomBoolean.truthy?(self) && CustomBoolean.truthy?(other) end |
#|(other) ⇒ Boolean Also known as: or
Equivalent of *||* for CustomBoolean truthiness. Differs from regular *||* as it uses CustomBoolean truthiness
NOTE: It is usually better to use the #or alias, as fewer objects override this method)
38 39 40 |
# File 'lib/custom_boolean.rb', line 38 def |(other) CustomBoolean.truthy?(self) || CustomBoolean.truthy?(other) end |