Sha256: 62bde629dcbdadda053feb546fb450f6af6b679b5f41c9ab1d651238ce3ee71d

Contents?: true

Size: 679 Bytes

Versions: 14

Compression:

Stored size: 679 Bytes

Contents

require "json"  
require "nokogiri"

module Sei

  module Printer

    def self.jp(json_text)  
      puts JSON.pretty_generate json_text
    end

    def self.xp(xml_text)  
      xsl = <<~HEREDOC
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
          <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
          <xsl:strip-space elements="*"
          <xsl:template match="/">
            <xsl:copy-of select="."/>
          </xsl:template>
        </xsl:stylesheet>
      HEREDOC

      doc  = Nokogiri::XML(xml_text)
      xslt = Nokogiri::XSLT(xsl)
      out  = xslt.transform(doc)

      puts out.to_xml
    end 

  end

end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
zei-0.2.6 lib/sei/printer.rb
zei-0.2.5 lib/sei/printer.rb
zei-0.2.4 lib/sei/printer.rb
zei-0.2.3 lib/sei/printer.rb
zei-0.2.1 lib/sei/printer.rb
zei-0.2.0 lib/sei/printer.rb
zei-0.1.9 lib/sei/printer.rb
zei-0.1.8 lib/sei/printer.rb
zei-0.1.7 lib/sei/printer.rb
zei-0.1.6 lib/sei/printer.rb
zei-0.1.5 lib/sei/printer.rb
sei-0.1.4 lib/sei/printer.rb
sei-ima-0.1.2 lib/sei/printer.rb
sei-0.1.1 lib/sei/printer.rb