Module: YiffSpace::Extensions::Object::ToB

Included in:
Object
Defined in:
lib/yiffspace/extensions/object/to_b.rb

Instance Method Summary collapse

Instance Method Details

#to_bObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/yiffspace/extensions/object/to_b.rb', line 7

def to_b
  case self
  when ::String
    !match?(/\A(false|f|no|n|off|0)\z/i)
  when ::TrueClass
    true
  when ::FalseClass
    false
  else
    to_s.to_b
  end
end