Class: Sail::Types::Boolean

Inherits:
Type
  • Object
show all
Defined in:
lib/sail/types/boolean.rb

Overview

Boolean

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

Direct Known Subclasses

AbTest

Instance Method Summary collapse

Methods inherited from Type

#initialize

Constructor Details

This class inherits a constructor from Sail::Types::Type

Instance Method Details

#from(value) ⇒ Object



15
16
17
18
19
20
21
22
23
# 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_valueObject



11
12
13
# File 'lib/sail/types/boolean.rb', line 11

def to_value
  @setting.value == Sail::ConstantCollection::TRUE
end