Is there any standard way to avoid being true in Ruby, or do I need to roll my own solution like
class FalseClass def to_bool self end end class TrueClass def to_bool self end end true.to_bool
Background: I know that to_bool will contradict the resolving nature of Ruby, but I play with triple logic and want to avoid accidentally doing something like
require "ternary_logic" x = UNKNOWN do_something if x
I use ternary logic because I am writing a website parser for sharing photos (for personal rather than commercial use), and it is possible that some fields will be missing, and therefore it will not be known whether the place matches my criteria or not. However, I would try to limit the amount of code using triple logic.
source share