Class: String

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

Instance Method Summary collapse

Instance Method Details

#to_boolObject



44
45
46
47
48
49
50
51
52
53
# File 'lib/extensions/class-extensions.rb', line 44

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