Sha256: 04e98a147b757c3d9a5b7d91da0ab886897e47b74787d570915fe4edafa5d55c

Contents?: true

Size: 718 Bytes

Versions: 5

Compression:

Stored size: 718 Bytes

Contents

module Alf
  module Iterator
    class Proxy
      include Iterator

      # @return [Symbol] name of the dataset to request to environment
      attr_reader :name

      # Creates a proxy instance.
      #
      # @param [Environment] env the environment serving iterator instances
      # @param [Symbol] dataset named dataset to rely on
      def initialize(env, name)
        unless env.respond_to?(:dataset)
          raise ArgumentError, "Invalid environment #{env.inspect}"
        end
        @environment, @name = env, name
      end

      # (see Iterator#each)
      def each(&block)
        @environment.dataset(@name).each(&block)
      end

    end # class Proxy
  end # module Iterator
end # module Alf

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-0.12.2 lib/alf/iterator/proxy.rb
alf-0.12.1 lib/alf/iterator/proxy.rb
alf-0.12.0 lib/alf/iterator/proxy.rb
alf-0.11.1 lib/alf/iterator/proxy.rb
alf-0.11.0 lib/alf/iterator/proxy.rb