module Yoda::Store::Objects::Serializable

Public Class Methods

included(klass) click to toggle source
# File lib/yoda/store/objects/serializable.rb, line 16
def self.included(klass)
  klass.extend(ClassMethods)
end

Public Instance Methods

derive(params = {}) click to toggle source

Create a new instance which has the original parameters and overrided parameters. @param params [Hash{Symbol => Object}] parameters to override

# File lib/yoda/store/objects/serializable.rb, line 33
def derive(params = {})
  self.class.new(to_h.merge(params))
end
to_h() click to toggle source

@abstract @return [Hash]

# File lib/yoda/store/objects/serializable.rb, line 22
def to_h
  fail NotImplementedError
end
to_json(*options) click to toggle source

@return [String]

# File lib/yoda/store/objects/serializable.rb, line 27
def to_json(*options)
  to_h.merge(json_class: self.class.name).to_json
end