Module: SimplySerializable::Mixin

Defined in:
lib/simply_serializable/mixin.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



36
37
38
39
# File 'lib/simply_serializable/mixin.rb', line 36

def self.included(base)
  base.include(Fingerprintable::Mixin)
  base.extend(ClassMethods)
end

Instance Method Details

#simply_serializable_idObject



56
57
58
# File 'lib/simply_serializable/mixin.rb', line 56

def simply_serializable_id
  simply_serializer.id
end

#simply_serialize(cache: {}, **options) ⇒ Object



41
42
43
# File 'lib/simply_serializable/mixin.rb', line 41

def simply_serialize(cache: {}, **options)
  simply_serializer(cache: cache, **options).serialize
end

#simply_serializer(cache: {}, **options) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'lib/simply_serializable/mixin.rb', line 45

def simply_serializer(cache: {}, **options)
  Serializer.new(
    **self.class.simply_serializable_config.merge(
      options
    ).merge(
      cache: cache,
      object: self
    )
  )
end