Sha256: 0b3a0fe9aebed192e0f16ff20be0ff99413874b4eb4c30a53ecd237282e4b64e

Contents?: true

Size: 402 Bytes

Versions: 9

Compression:

Stored size: 402 Bytes

Contents

# frozen_string_literal: true

require "json"

module Phlexi
  module Display
    module Components
      class JSON < Base
        include Concerns::DisplaysValue

        def render_value(value)
          pre(**attributes) {
            value
          }
        end

        private

        def normalize_value(value)
          ::JSON.pretty_generate(value)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
phlexi-display-0.0.12 lib/phlexi/display/components/json.rb
phlexi-display-0.0.11 lib/phlexi/display/components/json.rb
phlexi-display-0.0.10 lib/phlexi/display/components/json.rb
phlexi-display-0.0.9 lib/phlexi/display/components/json.rb
phlexi-display-0.0.8 lib/phlexi/display/components/json.rb
phlexi-display-0.0.7 lib/phlexi/display/components/json.rb
phlexi-display-0.0.6 lib/phlexi/display/components/json.rb
phlexi-display-0.0.5 lib/phlexi/display/components/json.rb
phlexi-display-0.0.4 lib/phlexi/display/components/json.rb