Class: Rexslt
- Inherits:
-
Object
- Object
- Rexslt
- Defined in:
- lib/rexslt.rb
Instance Method Summary collapse
-
#initialize(xsl, xml, raw_params = {}, debug: false) ⇒ Rexslt
constructor
A new instance of Rexslt.
- #to_doc ⇒ Object
- #to_s(options = {}) ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(xsl, xml, raw_params = {}, debug: false) ⇒ Rexslt
Returns a new instance of Rexslt.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/rexslt.rb', line 67 def initialize(xsl, xml, raw_params={}, debug: false) ## debugging variables @rn = 0 @rre = 0 super() puts 'before options'.info if @debug @options = {} params = raw_params.merge({debug: false}) @debug = debug custom_params = params.inject({}){|r,x| r.merge(Hash[x[0].to_s,x[1]])} puts 'before xsl_transform'.info if @debug xslt_transform(*[xsl, xml].map{|x| RXFHelper.read(x).first}, custom_params) end |
Instance Method Details
#to_doc ⇒ Object
90 |
# File 'lib/rexslt.rb', line 90 def to_doc(); @doc; end |
#to_s(options = {}) ⇒ Object
86 87 88 |
# File 'lib/rexslt.rb', line 86 def to_s(={}) @doc.to_s(@options.merge()).sub(/<root4>/,'').sub(/<\/root4>$/m,'').lstrip end |
#to_xml ⇒ Object
92 93 94 |
# File 'lib/rexslt.rb', line 92 def to_xml() @doc.root.xml(pretty: true).sub(/<root4>/,'').sub(/<\/root4>$/m,'') end |