Sha256: d3c934358d1f7799badfad7475776d9bf27bb033b740d58c5d60fb6da6ad8a45

Contents?: true

Size: 596 Bytes

Versions: 14

Compression:

Stored size: 596 Bytes

Contents

module Bmg
  module Relation
    class InMemory
      class Mutable < InMemory
        def insert(arg)
          raise ArgumentError unless arg.is_a?(Hash)

          @operand << arg.dup
        end

        def update(updating, predicate = Predicate.tautology)
          @operand = @operand.map{|t|
            predicate.call(t) ? t.merge(updating) : t
          }
        end

        def delete(predicate = Predicate.tautology)
          @operand = @operand.select{|t| predicate.call(t) }
        end
      end # class Mutable
    end # class InMemory
  end # module Relation
end # module Bmg

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
bmg-0.23.3 lib/bmg/relation/in_memory/mutable.rb
bmg-0.23.2 lib/bmg/relation/in_memory/mutable.rb
bmg-0.23.1 lib/bmg/relation/in_memory/mutable.rb
bmg-0.23.0 lib/bmg/relation/in_memory/mutable.rb
bmg-0.21.5 lib/bmg/relation/in_memory/mutable.rb
bmg-0.21.4 lib/bmg/relation/in_memory/mutable.rb
bmg-0.20.5 lib/bmg/relation/in_memory/mutable.rb
bmg-0.21.3 lib/bmg/relation/in_memory/mutable.rb
bmg-0.21.2 lib/bmg/relation/in_memory/mutable.rb
bmg-0.21.0 lib/bmg/relation/in_memory/mutable.rb
bmg-0.20.4 lib/bmg/relation/in_memory/mutable.rb
bmg-0.20.2 lib/bmg/relation/in_memory/mutable.rb
bmg-0.20.1 lib/bmg/relation/in_memory/mutable.rb
bmg-0.20.0 lib/bmg/relation/in_memory/mutable.rb