Sha256: e70e7f0c6e5da5abff9545ce7e438bb63bf323d723c4b3000930ee27337f4945

Contents?: true

Size: 682 Bytes

Versions: 18

Compression:

Stored size: 682 Bytes

Contents

require "json"  
require "nokogiri"

module Imasei

  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

18 entries across 18 versions & 1 rubygems

Version Path
imasei-0.2.13 lib/imasei/printer.rb
imasei-0.2.12 lib/imasei/printer.rb
imasei-0.2.11 lib/imasei/printer.rb
imasei-0.2.10 lib/imasei/printer.rb
imasei-0.2.9 lib/imasei/printer.rb
imasei-0.2.8 lib/imasei/printer.rb
imasei-0.2.7 lib/imasei/printer.rb
imasei-0.2.6 lib/imasei/printer.rb
imasei-0.2.5 lib/imasei/printer.rb
imasei-0.2.4 lib/imasei/printer.rb
imasei-0.2.3 lib/imasei/printer.rb
imasei-0.2.2 lib/imasei/printer.rb
imasei-0.2.1 lib/imasei/printer.rb
imasei-0.2.0 lib/imasei/printer.rb
imasei-0.1.9 lib/imasei/printer.rb
imasei-0.1.8 lib/imasei/printer.rb
imasei-0.1.7 lib/imasei/printer.rb
imasei-0.1.6 lib/imasei/printer.rb