Sha256: 73f5e17b313f2b64722ea84cab8c524c253c2435ec998dd36f341c1296b0a9bf

Contents?: true

Size: 286 Bytes

Versions: 6

Compression:

Stored size: 286 Bytes

Contents

# frozen_string_literal: true

module Kredis
  module Type
    class Json < ActiveModel::Type::Value
      def type
        :json
      end

      def cast_value(value)
        JSON.parse(value)
      end

      def serialize(value)
        JSON.dump(value)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kredis-1.7.0 lib/kredis/type/json.rb
kredis-1.6.1 lib/kredis/type/json.rb
kredis-1.6.0 lib/kredis/type/json.rb
kredis-1.5.0 lib/kredis/type/json.rb
kredis-1.4.0 lib/kredis/type/json.rb
kredis-1.3.0.1 lib/kredis/type/json.rb