Class: RSStoDynarex
- Inherits:
-
Object
- Object
- RSStoDynarex
- Defined in:
- lib/rss_to_dynarex.rb
Instance Attribute Summary collapse
-
#to_dynarex ⇒ Object
readonly
Returns the value of attribute to_dynarex.
Instance Method Summary collapse
-
#initialize(url) ⇒ RSStoDynarex
constructor
A new instance of RSStoDynarex.
Constructor Details
#initialize(url) ⇒ RSStoDynarex
Returns a new instance of RSStoDynarex.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# 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.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 |
Instance Attribute Details
#to_dynarex ⇒ Object (readonly)
Returns the value of attribute to_dynarex.
10 11 12 |
# File 'lib/rss_to_dynarex.rb', line 10 def to_dynarex @to_dynarex end |