module BoolTypecasting

Public Instance Methods

to_bool() click to toggle source
# File lib/monza/bool_typecasting.rb, line 3
def to_bool
  return true if self == true || self =~ (/^(true|t|yes|y|1)$/i)
  return false if self == false || self.empty? || self =~ (/^(false|f|no|n|0)$/i)
  raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
end
to_i() click to toggle source
# File lib/monza/bool_typecasting.rb, line 26
def to_i; 1; end