Sha256: fe7e9756e23237aa08d78a24b8f2ced2b9089454619064c806e035717b22c069
Contents?: true
Size: 818 Bytes
Versions: 2
Compression:
Stored size: 818 Bytes
Contents
module MicroMicro module Collections class BaseCollection extend Forwardable include Enumerable def_delegators :members, :[], :each, :last, :length, :split # @param members [Array<MicroMicro::Item, MicroMicro::Property, MicroMicro::Relationship>] def initialize(members = []) members.each { |member| push(member) } end # @return [String] def inspect format(%(#<#{self.class.name}:%#0x count: #{count}, members: #{members.inspect}>), object_id) end # @param member [MicroMicro::Item, MicroMicro::Property, MicroMicro::Relationship] def push(member) members << member member.collection = self end alias << push private def members @members ||= [] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
micromicro-1.1.0 | lib/micro_micro/collections/base_collection.rb |
micromicro-1.0.0 | lib/micro_micro/collections/base_collection.rb |