Module: Rootage::BooleanValue

Defined in:
lib/rootage/normalizer.rb

Class Method Summary collapse

Class Method Details

.of(val) ⇒ Boolean

Return boolean value of the object.

Parameters:

  • val (Object)

    target object

Returns:

  • (Boolean)

    boolean of the object



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/rootage/normalizer.rb', line 138

def of(val)
  case val
  when NilClass
    false
  when TrueClass
    true
  when FalseClass
    false
  when String
    of_string(val)
  when Number
    of_number(val)
  else
    raise ArgumentError.new(val)
  end
end