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
-
#store ⇒ Object
Returns the value of attribute store.
Instance Method Summary collapse
-
#<<(param) ⇒ Object
Adds a new object to the collection.
- #collection_type ⇒ Object
- #initialize ⇒ Object
Methods included from EnsureType
Instance Attribute Details
#store ⇒ Object
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_type ⇒ Object
16 17 18 |
# File 'lib/pagseguro/extensions/collection_object.rb', line 16 def collection_type PagSeguro.const_get(class_name_singularized) end |
#initialize ⇒ Object
12 13 14 |
# File 'lib/pagseguro/extensions/collection_object.rb', line 12 def initialize @store = [] end |