Sha256: 602e44e56250e240bfca0b7ebe137806133ca15e0dfc715b68c2da364197f8aa

Contents?: true

Size: 490 Bytes

Versions: 23

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

23 entries across 23 versions & 3 rubygems

Version Path
active_cached_resource-0.1.8 lib/activeresource/lib/active_resource/formats/json_format.rb
active_cached_resource-0.1.7 lib/activeresource/lib/active_resource/formats/json_format.rb
active_cached_resource-0.1.6 lib/activeresource/lib/active_resource/formats/json_format.rb
active_cached_resource-0.1.5 lib/activeresource/lib/active_resource/formats/json_format.rb
active_cached_resource-0.1.4 lib/activeresource/lib/active_resource/formats/json_format.rb
active_cached_resource-0.1.3 lib/activeresource/lib/active_resource/formats/json_format.rb
active_cached_resource-0.1.2 lib/activeresource/lib/active_resource/formats/json_format.rb
active_cached_resource-0.1.1 lib/activeresource/lib/active_resource/formats/json_format.rb
active_cached_resource-0.1.0 lib/activeresource/lib/active_resource/formats/json_format.rb
active_cached_resource-0.0.1.pre lib/activeresource/lib/active_resource/formats/json_format.rb
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