Module: Served::Resource::Serializable

Extended by:
ActiveSupport::Concern
Included in:
Attribute::Base, Base
Defined in:
lib/served/resource/serializable.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#dumpObject



93
94
95
96
97
98
99
# File 'lib/served/resource/serializable.rb', line 93

def dump
  if respond_to?(:presenter)
    warn 'DEPRECATION WARNING: using presenters is deprecated and will be removed in served 1.0'
    return presenter.to_json
  end
  self.class.serializer.dump(self, attributes)
end

#load(string) ⇒ Object



101
102
103
# File 'lib/served/resource/serializable.rb', line 101

def load(string)
  self.class.serializer.load(string)
end

#to_json(*_args) ⇒ Object



89
90
91
# File 'lib/served/resource/serializable.rb', line 89

def to_json(*_args)
  dump
end