Sha256: b91d37e94b1e16713c1806806f6d4aa8ab7445f4f04646b5c231ebf97cef693e

Contents?: true

Size: 772 Bytes

Versions: 14

Compression:

Stored size: 772 Bytes

Contents

module Clever
  # Helpers for handling JSON responses
  module JSON
    if MultiJson.respond_to? :dump
      # Dump as a JSON string
      # @api private
      # @return [String]
      def self.dump(*args)
        MultiJson.dump(*args)
      end

      # Load a JSON string to an object
      # @api private
      # @return [Object]
      def self.load(*args)
        MultiJson.load(*args, symbolize_keys: true)
      end
    else
      # Dump as a JSON string
      # @api private
      # @return [String]
      def self.dump(*args)
        MultiJson.encode(*args)
      end

      # Load a JSON string to an object
      # @api private
      # @return [Object]
      def self.load(*args)
        MultiJson.decode(*args, symbolize_keys: true)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
clever-ruby-0.14.0 lib/clever-ruby/json.rb
clever-ruby-0.13.2 lib/clever-ruby/json.rb
clever-ruby-0.13.1 lib/clever-ruby/json.rb
clever-ruby-0.13.0 lib/clever-ruby/json.rb
clever-ruby-0.11.1 lib/clever-ruby/json.rb
clever-ruby-0.11.0 lib/clever-ruby/json.rb
clever-ruby-0.10.2 lib/clever-ruby/json.rb
clever-ruby-0.10.1 lib/clever-ruby/json.rb
clever-ruby-0.10.0 lib/clever-ruby/json.rb
clever-ruby-0.9.0 lib/clever-ruby/json.rb
clever-ruby-0.8.0 lib/clever-ruby/json.rb
clever-ruby-0.7.0 lib/clever-ruby/json.rb
clever-ruby-0.6.2 lib/clever-ruby/json.rb
clever-ruby-0.6.1 lib/clever-ruby/json.rb