Module: Shamu::ToBoolExtension::Strings
- Defined in:
- lib/shamu/to_bool_extension.rb
Overview
Add to_model_id
to String types.
Instance Method Summary collapse
Instance Method Details
#to_bool(default = false) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/shamu/to_bool_extension.rb', line 18 def to_bool( default = false ) case self when "1", /\At(rue)?\z/i, /\Ay(es)?\z/i then true when "0", "", /\Af(alse)?\z/i, /\An(o)?\z/i then false else default end end |