Module: Shaf::JsonHtml

Defined in:
lib/shaf/helpers/json_html.rb

Constant Summary collapse

STRUCTURAL_PATTERN =
/^[\[\]\{\}:,]$/.freeze

Instance Method Summary collapse

Instance Method Details

#as_html(obj) ⇒ Object



11
12
13
# File 'lib/shaf/helpers/json_html.rb', line 11

def as_html(obj)
  "<pre><code>#{to_html(obj)}</code></pre>"
end

#json2html(json) ⇒ Object



7
8
9
# File 'lib/shaf/helpers/json_html.rb', line 7

def json2html(json)
  as_html JSON.parse(json)
end