Sha256: 0a6c221469f725cf6309394ff2b2033b33183746c24c3026c7ee425e5bf61869

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

module AQL
  class Node
    class Operation
      # Base class for nary operations
      class Nary < self
        include Concord.new(:body)

      private

        # Emit node
        #
        # @param [Buffer] buffer
        #
        # @return [undefined]
        #
        # @api private
        #
        def emit(buffer)
          buffer.append("#{keyword} ")
          buffer.delimited(body)
        end

        # FILTER operation
        class Sort < self
          KEYWORD = :SORT
        end

        # COLLECT operation
        class Collect < self
          KEYWORD = :COLLECT

          # COLLECT INTO operation
          class Into < self
            include Concord.new(:body, :name)

          private

            # Emit node
            #
            # @param [Buffer] buffer
            #
            # @return [undefined]
            #
            # @api private
            #
            def emit(buffer)
              super
              buffer.append(' INTO ')
              name.visit(buffer)
            end
          end
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aql-0.0.3 lib/aql/node/operation/nary.rb
aql-0.0.2 lib/aql/node/operation/nary.rb
aql-0.0.1 lib/aql/node/operation/nary.rb