Module: Torznab::Client::Caps::Mappers::SearchModeMapper

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

Overview

SearchMode mapping

Class Method Summary collapse

Class Method Details

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

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


22
23
24
25
26
27
28
29
30
31
32
# File 'lib/torznab/client/caps/mappers/search_mode_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

  search_mode = SearchMode.new
  search_mode.type = map_type xml_element
  search_mode.available = map_available xml_element
  search_mode.supported_params = map_supported_params xml_element
  search_mode
end