Method: String#to_bool

Defined in:
lib/bcl/core_ext.rb

#to_boolObject



19
20
21
22
23
24
# File 'lib/bcl/core_ext.rb', line 19

def to_bool
  return true if self == true || self =~ /(true|t|yes|y|1)$/i
  return false if self == false || self =~ /(false|f|no|n|0)$/i

  raise "invalid value for Boolean: '#{self}'"
end