Module: Torznab::Client::Caps::Mappers::InstanceMapper

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

Overview

Instance of caps mapper

Class Method Summary collapse

Class Method Details

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

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

Parameters:

  • xml_element (Nokogiri::XML::Element)

    data from a caps node to map

Returns:

Raises:


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

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

  caps = Torznab::Client::Caps::Instance.new
  caps.search_modes = map_search_modes xml_element
  caps.categories = map_categories xml_element
  caps
end