Sha256: 4f3ea9000b135102ccb655669015fa8a69db4fbd18d2ae2a48379f99b8136971

Contents?: true

Size: 793 Bytes

Versions: 5

Compression:

Stored size: 793 Bytes

Contents

module Alf
  module Algebra
    class Rank
      include Operator
      include Relational
      include Unary

      signature do |s|
        s.argument :order, Ordering, []
        s.argument :as, AttrName, :rank
      end

      def heading
        @heading ||= operand.heading.merge(as => Integer)
      end

      def keys
        @keys ||= begin
          keys, selectors = operand.keys, order.to_attr_list
          if keys.any?{|k| k.subset_of?(selectors) }
            keys + [ AttrList[as] ]
          else
            keys
          end
        end
      end

    private

      def _type_check(options)
        valid_ordering!(order, operand.attr_list)
        no_name_clash!(operand.attr_list, AttrList[as])
      end

    end # class Rank
  end # module Algebra
end # module Alf

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-core-0.16.3 lib/alf/algebra/operator/rank.rb
alf-core-0.16.2 lib/alf/algebra/operator/rank.rb
alf-core-0.16.1 lib/alf/algebra/operator/rank.rb
alf-core-0.16.0 lib/alf/algebra/operator/rank.rb
alf-core-0.15.0 lib/alf/algebra/operator/rank.rb