Module: PagSeguro::Extensions::CollectionObject

Extended by:
Forwardable
Includes:
Enumerable, EnsureType
Included in:
Documents, Items, Phones, SubscriptionTransactions
Defined in:
lib/pagseguro/extensions/collection_object.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from EnsureType

#ensure_type

Instance Attribute Details

#storeObject

Returns the value of attribute store.



10
11
12
# File 'lib/pagseguro/extensions/collection_object.rb', line 10

def store
  @store
end

Instance Method Details

#<<(param) ⇒ Object

Adds a new object to the collection.



21
22
23
24
# File 'lib/pagseguro/extensions/collection_object.rb', line 21

def <<(param)
  object = ensure_type(collection_type, param)
  @store << object unless include?(object)
end

#collection_typeObject



16
17
18
# File 'lib/pagseguro/extensions/collection_object.rb', line 16

def collection_type
  PagSeguro.const_get(class_name_singularized)
end

#initializeObject



12
13
14
# File 'lib/pagseguro/extensions/collection_object.rb', line 12

def initialize
  @store = []
end