Module: Id::Boolean

Extended by:
Boolean
Included in:
Boolean
Defined in:
lib/id/boolean.rb

Instance Method Summary collapse

Instance Method Details

#parse(value) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/id/boolean.rb', line 4

def parse(value)
  case value
  when String     then ['yes', 'true', '1'].include?(value.to_s.downcase)
  when Symbol     then ['yes', 'true', '1'].include?(value.to_s.downcase)
  when Fixnum     then value != 0
  when TrueClass  then true
  else false
  end
end