Module: Id::Boolean
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 |