class String

Public Instance Methods

to_bool() click to toggle source

Convert a string to a bool

Returns

  • bool, or throws ArgumentError if not possible to parse

# File lib/onapp_market/api/response.rb, line 6
def to_bool
  return true if self == true || self =~ (/(true|t|yes|y|1)$/)
  return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/)
  raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
end
url_safe() click to toggle source

Make a String URL safe

Returns

String

# File lib/onapp_market.rb, line 59
def url_safe
  URI::encode(self)
end