Sha256: a944b64ba87d775d5b58b3526e79674cd74b8c9276bda60dedf05c72a9560af3

Contents?: true

Size: 994 Bytes

Versions: 3

Compression:

Stored size: 994 Bytes

Contents

module Alf
  #
  # Marker module for all elements implementing tuple iterators.
  #
  # At first glance, an iterator is nothing else than an Enumerable that serves
  # tuples (represented by ruby hashes). However, this module helps Alf's
  # internal classes to recognize enumerables that may safely be considered as
  # tuple iterators from other enumerables. For this reason, all elements that
  # would like to participate to an iteration chain (that is, an logical
  # operator implementation) should be marked with this module. This is the case
  # for all Readers and Operators defined in Alf.
  #
  module Iterator
    include Enumerable

    # Converts this iterator to an in-memory Relation.
    #
    # @return [Relation] a relation instance, as the set of tuples
    #         that would be yield by this iterator.
    def to_rel
      Relation::coerce(self)
    end

    require 'alf/iterator/class_methods'
    require 'alf/iterator/proxy'
  end # module Iterator
end # module Alf

Version data entries

3 entries across 3 versions & 1 rubygems

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