class String

Public Instance Methods

to_bool() click to toggle source
# File lib/to-bool.rb, line 2
def to_bool
  if self =~ /^(true|false)$/
    return true if $1 == 'true'
    return false if $1 == 'false'
  else
    raise ArgumentError.new("invalid value for `to_bool': '#{self}'")
  end
end