Module: Torznab::Client::Caps::Mappers::SearchModesMapper

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

Overview

Searching node 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 Searching object corresponding of a searching node of the caps xml

Parameters:

  • xml_element (Nokogiri::XML::Element)

    data from searching node to map

Returns:

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

    Mapped searching object

Raises:


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

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

  searching = SearchModes.new
  searching.search = map_search xml_element, 'search'
  searching.tv_search = map_search xml_element, 'tv-search'
  searching.movie_search = map_search xml_element, 'movie-search'
  searching
end