Module: Served::Resource::Serializable::ClassMethods
- Defined in:
- lib/served/resource/serializable.rb
Instance Method Summary collapse
Instance Method Details
#from_hash(hash) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/served/resource/serializable.rb', line 34 def from_hash(hash) hash = hash.clone hash.each do |name, value| hash[name] = serialize_attribute(name, value) end hash.symbolize_keys end |
#load(string) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/served/resource/serializable.rb', line 24 def load(string) begin result = serializer.load(self, string) rescue StandardError => e raise ResponseInvalid.new(self, e) end raise ResponseInvalid.new(self) unless result result end |