Module: Torznab::Client::Caps::Mappers::SubcategoryMapper

Extended by:
CategoryOrSubcategoryMapper
Defined in:
lib/torznab/client/caps/mappers/subcategory_mapper.rb

Overview

Subcategory mapping

Class Method Summary collapse

Class Method Details

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

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

Parameters:

  • xml_element (Nokogiri::XML::Element)

    data from subcat node to map

Returns:

  • (Torznab::Client::Caps::Searching)

    Mapped searching object

Raises:


21
22
23
24
25
26
27
28
29
30
# File 'lib/torznab/client/caps/mappers/subcategory_mapper.rb', line 21

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

  subcategory = Subcategory.new
  subcategory.id = map_id xml_element
  subcategory.name = map_name xml_element
  subcategory
end