Sha256: 7c9a7623bd3a3092430d79f6bfb50183e654d06bf731d49364b588426dcc7f3b

Contents?: true

Size: 968 Bytes

Versions: 1

Compression:

Stored size: 968 Bytes

Contents

# encoding: utf-8

module Axiom
  class Relation

    # An empty relation
    class Empty < Materialized
      ZERO_TUPLE = EMPTY_ARRAY

      # Initialize an empty Relation
      #
      # @param [Header] _header
      #   the header for the empty relation
      # @param [#each] _tuples
      #   optional original tuples
      #
      # @return [undefined]
      #
      # @api public
      def initialize(_header, _tuples = ZERO_TUPLE)
        super
      end

      # Noop #each method
      #
      # @example
      #   empty = Empty.new(header)
      #   empty.each { ... }
      #
      # @return [self]
      #
      # @api public
      def each
        return to_enum unless block_given?
        self
      end

      # Return the number of tuples
      #
      # @example
      #   empty.size  # => 0
      #
      # @return [0]
      #
      # @api public
      def size
        0
      end

    end # class Empty
  end # class Relation
end # module Axiom

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.0 lib/axiom/relation/empty.rb