class RSStoDynarex
Attributes
to_dynarex[R]
Public Class Methods
new(url)
click to toggle source
# File lib/rss_to_dynarex.rb, line 12 def initialize(url) lib = File.dirname(__FILE__) xsl_buffer = File.read(lib + '/rss_to_dynarex.xsl') #xsl_buffer = File.read('rss_to_dynarex.xsl') xslt = Nokogiri::XSLT(xsl_buffer) #doc = open(url, 'UserAgent' => 'RSStoDynarex'){|x| x.read } doc = RXFHelper.read(url).first doc.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') xml_buffer = xslt.transform(Nokogiri::XML(doc.to_s)).to_s @to_dynarex = Dynarex.new xml_buffer end