Sha256: 602e44e56250e240bfca0b7ebe137806133ca15e0dfc715b68c2da364197f8aa

Contents?: true

Size: 490 Bytes

Versions: 13

Compression:

Stored size: 490 Bytes

Contents

# frozen_string_literal: true

require "active_support/json"

module ActiveResource
  module Formats
    module JsonFormat
      extend self

      def extension
        "json"
      end

      def mime_type
        "application/json"
      end

      def encode(hash, options = nil)
        ActiveSupport::JSON.encode(hash, options)
      end

      def decode(json)
        return nil if json.nil?
        Formats.remove_root(ActiveSupport::JSON.decode(json))
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
activeresource-6.1.4 lib/active_resource/formats/json_format.rb
activeresource-6.1.3 lib/active_resource/formats/json_format.rb
activeresource-6.1.2 lib/active_resource/formats/json_format.rb
activeresource-6.1.1 lib/active_resource/formats/json_format.rb
activeresource-6.1.0 lib/active_resource/formats/json_format.rb
ric-0.14.2 vendor/bundle/ruby/2.7.0/gems/activeresource-5.1.1/lib/active_resource/formats/json_format.rb
ric-0.14.1 vendor/bundle/ruby/2.7.0/gems/activeresource-5.1.1/lib/active_resource/formats/json_format.rb
activeresource-6.0.0 lib/active_resource/formats/json_format.rb
ric-0.14.0 vendor/bundle/ruby/2.7.0/gems/activeresource-5.1.1/lib/active_resource/formats/json_format.rb
activeresource-5.1.1 lib/active_resource/formats/json_format.rb
ric-0.13.0 vendor/bundle/ruby/2.5.0/gems/activeresource-5.1.0/lib/active_resource/formats/json_format.rb
ric-0.12.2 vendor/bundle/ruby/2.5.0/gems/activeresource-5.1.0/lib/active_resource/formats/json_format.rb
activeresource-5.1.0 lib/active_resource/formats/json_format.rb