Sha256: 6fbf1a0c935ade43f57aa280b54c3700071c107a8663de63528a6f0252f6a018

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

# frozen_string_literal: true
require 'json/ext'
# module Mutils
module Mutils
  module Serialization
    # BaseSerializer
    class BaseSerializer
      include Mutils::Serialization::SerializationIncludes
      include Mutils::Serialization::SerializationMethods
      include Mutils::Serialization::SerializationResults
      attr_accessor :scope, :options, :mutex

      def initialize(object, options = {})
        self.scope = object
        self.options = options
        self.mutex = Mutex.new
      end

      def as_json(_options = {})
        to_h
      end

      def to_h
        generate_hash
      end

      def to_json(_options = {})
        JSON.generate(to_h)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mutils-0.2.25 lib/mutils/serialization/base_serializer.rb