Class: Boolean

Inherits:
Object
  • Object
show all
Defined in:
lib/locomotive/core_ext.rb

Overview

:nodoc

Constant Summary collapse

BOOLEAN_MAP =
{
  true => true, "true" => true, "TRUE" => true, "1" => true, 1 => true, 1.0 => true,
  false => false, "false" => false, "FALSE" => false, "0" => false, 0 => false, 0.0 => false
}

Class Method Summary collapse

Class Method Details

.get(value) ⇒ Object


76
77
78
# File 'lib/locomotive/core_ext.rb', line 76

def self.get(value)
  value
end

.set(value) ⇒ Object


71
72
73
74
# File 'lib/locomotive/core_ext.rb', line 71

def self.set(value)
  value = BOOLEAN_MAP[value]
  value.nil? ? nil : value
end