Class: Petfinder::Pet
- Inherits:
-
Object
- Object
- Petfinder::Pet
- Extended by:
- XmlMapper
- Defined in:
- lib/petfinder/pet.rb
Defined Under Namespace
Classes: Photo
Instance Attribute Summary collapse
-
#photos ⇒ Object
readonly
Returns the value of attribute photos.
Class Method Summary collapse
Instance Method Summary collapse
- #breeds ⇒ Object
- #description_sanitized ⇒ Object
-
#initialize(xml) ⇒ Pet
constructor
A new instance of Pet.
- #options ⇒ Object
Methods included from XmlMapper
camel_case_lower, xml_attribute, xml_attributes
Constructor Details
#initialize(xml) ⇒ Pet
Returns a new instance of Pet.
10 11 12 |
# File 'lib/petfinder/pet.rb', line 10 def initialize(xml) @xml = xml end |
Instance Attribute Details
#photos ⇒ Object (readonly)
Returns the value of attribute photos.
8 9 10 |
# File 'lib/petfinder/pet.rb', line 8 def photos @photos end |
Class Method Details
Instance Method Details
#breeds ⇒ Object
24 25 26 |
# File 'lib/petfinder/pet.rb', line 24 def breeds @xml.xpath("//pet/breeds/breed").map(&:text) end |
#description_sanitized ⇒ Object
20 21 22 |
# File 'lib/petfinder/pet.rb', line 20 def description_sanitized Nokogiri::HTML(CGI.unescapeHTML(description)).content end |
#options ⇒ Object
28 29 30 |
# File 'lib/petfinder/pet.rb', line 28 def @xml.xpath("//pet/options/option").map(&:text) end |