Sha256: 5942f2e522e03e8cea3ba261c91b74602a72283e4cd4296611e6107fcc9cfc23

Contents?: true

Size: 748 Bytes

Versions: 16

Compression:

Stored size: 748 Bytes

Contents

# frozen_string_literal: true

class Serega
  module SeregaJSON
    #
    # JSON dump adapter for ::Oj
    #
    class OjDump
      # Default Oj serialization options
      OPTS = {mode: :compat}.freeze

      #
      # Dumps data to JSON string
      #
      # @param data [Object] Anything
      #
      # @return [String] Data serialized to JSON
      #
      def self.call(data)
        ::Oj.dump(data, OPTS)
      end
    end

    #
    # JSON parse adapter for ::Oj
    #
    class OjLoad
      #
      # Loads object from JSON string
      #
      # @param json_string [String] JSON String
      #
      # @return [Object] Deserialized data
      #
      def self.call(json_string)
        ::Oj.load(json_string)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
serega-0.21.0 lib/serega/json/oj.rb
serega-0.20.1 lib/serega/json/oj.rb
serega-0.20.0 lib/serega/json/oj.rb
serega-0.19.0 lib/serega/json/oj.rb
serega-0.18.0 lib/serega/json/oj.rb
serega-0.17.0 lib/serega/json/oj.rb
serega-0.16.0 lib/serega/json/oj.rb
serega-0.15.0 lib/serega/json/oj.rb
serega-0.14.0 lib/serega/json/oj.rb
serega-0.12.0 lib/serega/json/oj.rb
serega-0.11.2 lib/serega/json/oj.rb
serega-0.11.1 lib/serega/json/oj.rb
serega-0.11.0 lib/serega/json/oj.rb
serega-0.10.0 lib/serega/json/oj.rb
serega-0.9.0 lib/serega/json/oj.rb
serega-0.8.3 lib/serega/json/oj.rb