class Parser::XmlBase
Public Class Methods
new(source, options = {})
click to toggle source
# File lib/fly_parser/xml_base.rb, line 3 def initialize(source, options = {}) if options[:type] == :file source = fake_url(source) end @copyright = copyright(options) @source = Parser.connect(source) @delay ||= 10 @enable_tags = tags(options) end
Public Instance Methods
copyright(options)
click to toggle source
# File lib/fly_parser/xml_base.rb, line 21 def copyright(options) source = options[:source] { url: source['copyright'], title: source['copyright_title'] } end
fake_url(source)
click to toggle source
# File lib/fly_parser/xml_base.rb, line 13 def fake_url(source) stream = File.read(source) # test_file.com is a random url, just for Mechanize parsing url = "http://www.google.com" FakeWeb.register_uri(:get, url, :body => stream, :content_type => "application/xml") url end