class Sail::Types::Boolean

Boolean

The Boolean type simply returns true or false depending on what is stored in the database.

Public Instance Methods

from(value) click to toggle source
# File lib/sail/types/boolean.rb, line 15
def from(value)
  if value.is_a?(::String)
    check_for_on_or_boolean(value)
  elsif value.nil?
    Sail::ConstantCollection::FALSE
  else
    value.to_s
  end
end
to_value() click to toggle source
# File lib/sail/types/boolean.rb, line 11
def to_value
  @setting.value == Sail::ConstantCollection::TRUE
end

Private Instance Methods

check_for_on_or_boolean(value) click to toggle source
# File lib/sail/types/boolean.rb, line 27
def check_for_on_or_boolean(value)
  value == Sail::ConstantCollection::ON ? Sail::ConstantCollection::TRUE : value
end