class MuchBoolean

Constants

FALSE_VALUES
VERSION

Attributes

actual[R]
given[R]

Public Class Methods

ON_OFF(boolean) click to toggle source
# File lib/much-boolean.rb, line 79
def self.ON_OFF(boolean)
  Mapping.new(boolean, "ON", "OFF")
end
On_Off(boolean) click to toggle source
# File lib/much-boolean.rb, line 75
def self.On_Off(boolean)
  Mapping.new(boolean, "On", "Off")
end
TRUE_FALSE(boolean) click to toggle source
# File lib/much-boolean.rb, line 67
def self.TRUE_FALSE(boolean)
  Mapping.new(boolean, "TRUE", "FALSE")
end
T_F(boolean) click to toggle source
# File lib/much-boolean.rb, line 55
def self.T_F(boolean)
  Mapping.new(boolean, "T", "F")
end
True_False(boolean) click to toggle source
# File lib/much-boolean.rb, line 63
def self.True_False(boolean)
  Mapping.new(boolean, "True", "False")
end
YES_NO(boolean) click to toggle source
# File lib/much-boolean.rb, line 99
def self.YES_NO(boolean)
  Mapping.new(boolean, "YES", "NO")
end
Y_N(boolean) click to toggle source
# File lib/much-boolean.rb, line 87
def self.Y_N(boolean)
  Mapping.new(boolean, "Y", "N")
end
Yes_No(boolean) click to toggle source
# File lib/much-boolean.rb, line 95
def self.Yes_No(boolean)
  Mapping.new(boolean, "Yes", "No")
end
convert(value) click to toggle source
# File lib/much-boolean.rb, line 43
def self.convert(value)
  !FALSE_VALUES.include?(value)
end
new(given = nil) click to toggle source
# File lib/much-boolean.rb, line 105
def initialize(given = nil)
  @given  = given
  @actual = self.class.convert(@given)
end
on_off(boolean) click to toggle source
# File lib/much-boolean.rb, line 71
def self.on_off(boolean)
  Mapping.new(boolean, "on", "off")
end
one_zero(boolean) click to toggle source
# File lib/much-boolean.rb, line 47
def self.one_zero(boolean)
  Mapping.new(boolean, 1, 0)
end
t_f(boolean) click to toggle source
# File lib/much-boolean.rb, line 51
def self.t_f(boolean)
  Mapping.new(boolean, "t", "f")
end
true_false(boolean) click to toggle source
# File lib/much-boolean.rb, line 59
def self.true_false(boolean)
  Mapping.new(boolean, "true", "false")
end
y_n(boolean) click to toggle source
# File lib/much-boolean.rb, line 83
def self.y_n(boolean)
  Mapping.new(boolean, "y", "n")
end
yes_no(boolean) click to toggle source
# File lib/much-boolean.rb, line 91
def self.yes_no(boolean)
  Mapping.new(boolean, "yes", "no")
end

Public Instance Methods

==(other) click to toggle source
# File lib/much-boolean.rb, line 110
def ==(other)
  actual == if other.is_a?(MuchBoolean)
    other.actual
  else
    other
  end
end