Sha256: 2e3f133e68252fab7283078d48857040fdc0a7a1ffcb18db7b09d007c9cc69c4

Contents?: true

Size: 562 Bytes

Versions: 2

Compression:

Stored size: 562 Bytes

Contents

module Alf
  module Operator::NonRelational
    class Autonum < Alf::Operator()
      include Operator::NonRelational, Operator::Transform
    
      signature do |s|
        s.argument :as, AttrName, :autonum
      end
          
      protected
        
      # (see Operator#_prepare)
      def _prepare
        @autonum = -1
      end
      
      # (see Operator::Transform#_tuple2tuple)
      def _tuple2tuple(tuple)
        tuple.merge(@as => (@autonum += 1))
      end
    
    end # class Autonum
  end # module Operator::NonRelational
end # module Alf

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alf-0.10.1 lib/alf/operator/non_relational/autonum.rb
alf-0.10.0 lib/alf/operator/non_relational/autonum.rb