Module: Torznab::Client::Caps::Mappers::CategoriesMapper

Defined in:
lib/torznab/client/caps/mappers/categories_mapper.rb

Overview

Categories mapping

Class Method Summary collapse

Class Method Details

.map(xml_element) ⇒ Torznab::Client::Caps::Categories

Map the data from a Nokogiri::XML::Element to a Categories object corresponding of a categories node of the caps xml

Parameters:

  • xml_element (Nokogiri::XML::Element)

    data from a category node to map

Returns:

  • (Torznab::Client::Caps::Categories)

    Mapped Categories instance

Raises:


18
19
20
21
22
23
24
# File 'lib/torznab/client/caps/mappers/categories_mapper.rb', line 18

def map(xml_element)
  unless xml_element.is_a? Nokogiri::XML::Element
    raise Torznab::Client::Errors::XmlError, 'Provided object is not a Nokogiri::XML::Element'
  end

  map_categories xml_element
end