Module: Shamu::ToBoolExtension::Integers

Defined in:
lib/shamu/to_bool_extension.rb

Overview

Add to_model_id to Integer types.

Instance Method Summary collapse

Instance Method Details

#to_bool(default = false) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/shamu/to_bool_extension.rb', line 29

def to_bool( default = false )
  case self
  when 1 then true
  when 0 then false
  else        default
  end
end