Module: Resourcey::ControllerSerialization::ClassMethods

Defined in:
lib/resourcey/controller_serialization.rb

Instance Method Summary collapse

Instance Method Details

#configure_serialization {|self.serialization_config| ... } ⇒ Object

Yields:

  • (self.serialization_config)


38
39
40
41
42
43
# File 'lib/resourcey/controller_serialization.rb', line 38

def configure_serialization
  return unless block_given?
  self.serialization_config ||= Configuration.new
  yield(self.serialization_config)
  self.serialization_config
end

#serialize_with(serializer_name) ⇒ Object



32
33
34
35
36
# File 'lib/resourcey/controller_serialization.rb', line 32

def serialize_with(serializer_name)
  self.serialization_config ||= Configuration.new
  self.serialization_config.fallback_serializer =
    serializer_name.to_s.classify.constantize
end