Sha256: 2965825bcea42013f750dd55d257db3adffa0fbe1bf941392502c4142a7cc611

Contents?: true

Size: 1.14 KB

Versions: 15

Compression:

Stored size: 1.14 KB

Contents

module Vedeu

  module Repositories

    # Provides collection related query/command methods.
    #
    # @api private
    #
    module Assemblage

      include Enumerable

      # Return an individual element or collection of elements (if
      # the given index is a Range).
      #
      # @param index [Fixnum|Range]
      # @return [void]
      def [](index)
        collection[index]
      end

      # Provides iteration over the collection.
      #
      # @param block [Proc]
      # @return [Enumerator]
      def each(&block)
        collection.each(&block)
      end

      # Returns a boolean indicating whether the collection is empty.
      #
      # @return [Boolean]
      def empty?
        collection.empty?
      end

      # An object is equal when its values are the same.
      #
      # @param other [void]
      # @return [Boolean]
      def eql?(other)
        self.class == other.class && collection == other.collection
      end
      alias_method :==, :eql?

      # Return the size of the collection.
      #
      # @return [Fixnum]
      def size
        collection.size
      end

    end # Collection

  end # Repositories

end # Vedeu

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
vedeu-0.7.4 lib/vedeu/repositories/assemblage.rb
vedeu-0.7.3 lib/vedeu/repositories/assemblage.rb
vedeu-0.7.2 lib/vedeu/repositories/assemblage.rb
vedeu-0.7.1 lib/vedeu/repositories/assemblage.rb
vedeu-0.7.0 lib/vedeu/repositories/assemblage.rb
vedeu-0.6.71 lib/vedeu/repositories/assemblage.rb
vedeu-0.6.70 lib/vedeu/repositories/assemblage.rb
vedeu-0.6.69 lib/vedeu/repositories/assemblage.rb
vedeu-0.6.68 lib/vedeu/repositories/assemblage.rb
vedeu-0.6.67 lib/vedeu/repositories/assemblage.rb
vedeu-0.6.66 lib/vedeu/repositories/assemblage.rb
vedeu-0.6.65 lib/vedeu/repositories/assemblage.rb
vedeu-0.6.64 lib/vedeu/repositories/assemblage.rb
vedeu-0.6.63 lib/vedeu/repositories/assemblage.rb
vedeu-0.6.62 lib/vedeu/repositories/assemblage.rb