Sha256: 072ae19c952e2c4932956803fdb29a24a82483f13d93d10e5656caad3e8d03a0

Contents?: true

Size: 631 Bytes

Versions: 34

Compression:

Stored size: 631 Bytes

Contents

module Bmg
  module TupleAlgebra

    def allbut(tuple, butlist)
      tuple.reject{|k,v| butlist.include?(k) }
    end
    module_function :allbut

    def project(tuple, attrlist)
      tuple.reject{|k,v| !attrlist.include?(k) }
    end
    module_function :project

    def rename(tuple, renaming)
      tuple.each_with_object({}){|(k,v),m|
        m[renaming[k] || k] = v
        m
      }
    end
    module_function :rename

    def symbolize_keys(h)
      return h if h.empty?
      h.each_with_object({}){|(k,v),h| h[k.to_sym] = v }
    end
    module_function :symbolize_keys

  end # module TupleAlgebra
end # module Bmg

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
bmg-0.23.3 lib/bmg/support/tuple_algebra.rb
bmg-0.23.2 lib/bmg/support/tuple_algebra.rb
bmg-0.23.1 lib/bmg/support/tuple_algebra.rb
bmg-0.23.0 lib/bmg/support/tuple_algebra.rb
bmg-0.21.5 lib/bmg/support/tuple_algebra.rb
bmg-0.21.4 lib/bmg/support/tuple_algebra.rb
bmg-0.20.5 lib/bmg/support/tuple_algebra.rb
bmg-0.19.3 lib/bmg/support/tuple_algebra.rb
bmg-0.21.3 lib/bmg/support/tuple_algebra.rb
bmg-0.21.2 lib/bmg/support/tuple_algebra.rb
bmg-0.21.0 lib/bmg/support/tuple_algebra.rb
bmg-0.20.4 lib/bmg/support/tuple_algebra.rb
bmg-0.20.2 lib/bmg/support/tuple_algebra.rb
bmg-0.20.1 lib/bmg/support/tuple_algebra.rb
bmg-0.20.0 lib/bmg/support/tuple_algebra.rb
bmg-0.19.2 lib/bmg/support/tuple_algebra.rb
bmg-0.19.1 lib/bmg/support/tuple_algebra.rb
bmg-0.19.0 lib/bmg/support/tuple_algebra.rb
bmg-0.18.15 lib/bmg/support/tuple_algebra.rb
bmg-0.18.14 lib/bmg/support/tuple_algebra.rb