Sha256: 5019b629f3b89361ec3d06b3d2ad056511baaaa3e98b0dc274365618ab6c84fc
Contents?: true
Size: 918 Bytes
Versions: 4
Compression:
Stored size: 918 Bytes
Contents
# frozen_string_literal: true 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] # # :nocov: def inspect "#<#{self.class}:#{format('%#0x', object_id)} " \ "count: #{count}, " \ "members: #{members.inspect}>" end # :nocov: # @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
4 entries across 4 versions & 1 rubygems