Class: WebCrawler::View::Xml
- Inherits:
-
Base
- Object
- Base
- WebCrawler::View::Xml
show all
- Defined in:
- lib/web_crawler/view/xml.rb
Instance Attribute Summary
Attributes inherited from Base
#input
Instance Method Summary
collapse
Methods inherited from Base
#draw, #initialize
Instance Method Details
11
12
13
|
# File 'lib/web_crawler/view/xml.rb', line 11
def format(item)
response_tag item.is_a?(Hash) ? item : Hash[@options[:headers].zip item]
end
|
#render ⇒ Object
6
7
8
9
|
# File 'lib/web_crawler/view/xml.rb', line 6
def render
@options[:headers] ||= input.max_by(&:size).each_with_index.map { |_, index| "field_#{index+1}" }
"<responses>#{pretty}#{super}</responses>"
end
|