Sha256: c3da86c4eb60fce5b30b30182c1ecdc67d55c2ba3fccb3c655046443da0b0cd9
Contents?: true
Size: 491 Bytes
Versions: 12
Compression:
Stored size: 491 Bytes
Contents
require 'erb' require 'json' class Lurker::JsonPresenter attr_reader :json def initialize(json) @json = json end def to_html if json.is_a? String '<tt>"%s"</tt>' % json.gsub(/\"/, 'quot;') elsif json.is_a?(Numeric) || json.is_a?(TrueClass) || json.is_a?(FalseClass) '<tt>%s</tt>' % json elsif json.is_a?(Hash) || json.is_a?(Array) '<pre><code>%s</code></pre>' % JSON.pretty_generate(json) end end end
Version data entries
12 entries across 12 versions & 1 rubygems