Sha256: a14df66213fb996332ffdc26e7eada5afa1736619b734033cdc83f7846df5fdb

Contents?: true

Size: 464 Bytes

Versions: 10

Compression:

Stored size: 464 Bytes

Contents

module Patterns
  class Collection
    include Enumerable

    def initialize(*args)
      @options = args.extract_options!
      @subject = args.first
    end

    def each
      collection.each do |*args|
        yield(*args)
      end
    end

    class << self
      alias from new
      alias for new
    end

    private

    attr_reader :options, :subject

    def collection
      raise NotImplementedError, "#collection not implemented"
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rails-patterns-0.11.0 lib/patterns/collection.rb
rails-patterns-0.10.0 lib/patterns/collection.rb
rails-patterns-0.9.0 lib/patterns/collection.rb
rails-patterns-0.8.0 lib/patterns/collection.rb
rails-patterns-0.7.3 lib/patterns/collection.rb
rails-patterns-0.6.0 lib/patterns/collection.rb
rails-patterns-0.5.0 lib/patterns/collection.rb
rails-patterns-0.4.1 lib/patterns/collection.rb
rails-patterns-0.4.0 lib/patterns/collection.rb
rails-patterns-0.3.0 lib/patterns/collection.rb