Class: Dynamoid::Dumping::CustomTypeDumper

Inherits:
Base
  • Object
show all
Defined in:
lib/dynamoid/dumping.rb

Overview

any object -> string

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Dynamoid::Dumping::Base

Instance Method Details

#process(value) ⇒ Object


301
302
303
304
305
306
307
308
309
310
311
# File 'lib/dynamoid/dumping.rb', line 301

def process(value)
  field_class = @options[:type]

  if value.respond_to?(:dynamoid_dump)
    value.dynamoid_dump
  elsif field_class.respond_to?(:dynamoid_dump)
    field_class.dynamoid_dump(value)
  else
    raise ArgumentError, "Neither #{field_class} nor #{value} supports serialization for Dynamoid."
  end
end