Class: MicroMicro::Collections::BaseCollection
- Inherits:
-
Object
- Object
- MicroMicro::Collections::BaseCollection
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/micro_micro/collections/base_collection.rb
Direct Known Subclasses
ItemsCollection, PropertiesCollection, RelationshipsCollection
Instance Method Summary collapse
-
#initialize(members = []) ⇒ BaseCollection
constructor
A new instance of BaseCollection.
-
#inspect ⇒ String
:nocov:.
- #push(member) ⇒ Object (also: #<<)
Constructor Details
#initialize(members = []) ⇒ BaseCollection
Returns a new instance of BaseCollection.
13 14 15 |
# File 'lib/micro_micro/collections/base_collection.rb', line 13 def initialize(members = []) members.each { |member| push(member) } end |
Instance Method Details
#inspect ⇒ String
:nocov:
20 21 22 23 24 |
# File 'lib/micro_micro/collections/base_collection.rb', line 20 def inspect "#<#{self.class}:#{format('%#0x', object_id)} " \ "count: #{count}, " \ "members: #{members.inspect}>" end |
#push(member) ⇒ Object Also known as: <<
28 29 30 31 32 |
# File 'lib/micro_micro/collections/base_collection.rb', line 28 def push(member) members << member member.collection = self end |