Class: TestdataText
- Inherits:
-
Object
- Object
- TestdataText
- Defined in:
- lib/testdata_text.rb
Class Method Summary collapse
Class Method Details
.parse(raw_txt) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/testdata_text.rb', line 16 def self.parse(raw_txt) txt = raw_txt.split(/(?=\n=begin)/m)\ .map {|x| x.sub(/\n=begin.*=end/m,'')}.join rowx = RowX.new(txt, level: 1, ignore_blank_lines: false, abort_1_row: true) xml = rowx.to_xml lib = File.dirname(__FILE__) xsl = File.open(lib/'testdata.xsl','r').read doc = Nokogiri::XML(xml) xslt = Nokogiri::XSLT(xsl) xslt.transform(doc).to_s end |