Class: String

Inherits:
Object show all
Defined in:
lib/extensions/class-extensions.rb

Instance Method Summary collapse

Instance Method Details

#to_boolObject



53
54
55
56
57
58
59
60
61
62
# File 'lib/extensions/class-extensions.rb', line 53

def to_bool
  case self.chomp.upcase
    when 'TRUE', 'T', '1'
      true
    when 'FALSE', 'F', '0', ''
      false
    else
      error "Unable to convert #{self} to bool"
  end
end