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