class Dummy::Serializer
Attributes
object[R]
Public Class Methods
new(object)
click to toggle source
# File lib/dummy/serializer.rb, line 7 def initialize(object) @object = object end
Public Instance Methods
serialize()
click to toggle source
# File lib/dummy/serializer.rb, line 11 def serialize self.class.ancestors .grep(Attributes) .reverse .map(&:attributes) .reduce(:merge) .transform_values(&resolve_attributes) end
Private Instance Methods
resolve_attributes()
click to toggle source
# File lib/dummy/serializer.rb, line 24 def resolve_attributes ->(resolver) { instance_exec(object, &resolver) } end