class RealPage::AttributeParser::Boolean

Parse the response value of a boolean attribute

Constants

FALSE_VALUES

Values that RealPage responds with for true

TRUE_VALUES

Values that RealPage responds with for true

Public Instance Methods

parse() click to toggle source

@return [true|false] the parsed attribute value @raise [RealPage::Error::InvalidResponse] if the value doesn't parse

into true or false
# File lib/real_page/attribute_parser/boolean.rb, line 18
def parse
  return true if TRUE_VALUES.include?(value)
  return false if FALSE_VALUES.include?(value)
  raise Error::InvalidResponse, "Invalid boolean response value: #{value}"
end