Class: Decoradar::Collection

Inherits:
Attribute show all
Defined in:
lib/decoradar/collection.rb

Instance Attribute Summary collapse

Attributes inherited from Attribute

#as, #include_if, #name

Instance Method Summary collapse

Methods inherited from Attribute

#including?

Constructor Details

#initialize(options = {}) ⇒ Collection



5
6
7
8
# File 'lib/decoradar/collection.rb', line 5

def initialize(options = {})
  super(options)
  @serializer = options.fetch(:serializer)
end

Instance Attribute Details

#serializerObject (readonly)

Returns the value of attribute serializer.



3
4
5
# File 'lib/decoradar/collection.rb', line 3

def serializer
  @serializer
end

Instance Method Details

#serialize(hash, collection) ⇒ Object



10
11
12
# File 'lib/decoradar/collection.rb', line 10

def serialize(hash, collection)
  hash.merge(as => _serialize(collection))
end