Sha256: 8c482fb42e52556d13b8cbd69ebd7c823d0f50008f97f6657589b3c2b0c3f751

Contents?: true

Size: 501 Bytes

Versions: 1

Compression:

Stored size: 501 Bytes

Contents

module DashingJson
  module ViewHelpers
    
    def dashing_json(data)
      generate_html(data).html_safe
    end

    def generate_html(data)
      data = data.to_json unless data and data.is_a?(String)
      
      <<-HTML
        <div class='dashing-json'>
          <pre>
            <ul class='dashing-json-parsed'></ul>
            <div class='dashing-json-raw' data-dashing-json='#{ JSON.pretty_generate(JSON.parse(data)) }'></div>
          </pre>
        </div>
      HTML
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dashing_json-0.0.1 lib/dashing_json/view_helpers.rb