class Riak::Crdt::Set::BatchSet
Public Class Methods
new(base)
click to toggle source
# File lib/riak/crdt/set.rb, line 118 def initialize(base) @base = base @adds = ::Set.new @removes = ::Set.new end
Public Instance Methods
add(element)
click to toggle source
# File lib/riak/crdt/set.rb, line 124 def add(element) @adds.add element end
context?()
click to toggle source
# File lib/riak/crdt/set.rb, line 143 def context? @base.context? end
empty?()
click to toggle source
# File lib/riak/crdt/set.rb, line 139 def empty? members.empty? end
include?(element)
click to toggle source
# File lib/riak/crdt/set.rb, line 135 def include?(element) members.include? element end
members()
click to toggle source
# File lib/riak/crdt/set.rb, line 151 def members (@base + @adds).subtract @removes end
Also aliased as: value
operations()
click to toggle source
# File lib/riak/crdt/set.rb, line 157 def operations Operation::Update.new.tap do |op| op.type = :set op.value = {add: @adds.to_a, remove: @removes.to_a} end end
remove(element)
click to toggle source
# File lib/riak/crdt/set.rb, line 128 def remove(element) raise CrdtError::SetRemovalWithoutContextError.new unless context? @removes.add element end
Also aliased as: delete
to_a()
click to toggle source
# File lib/riak/crdt/set.rb, line 147 def to_a members.to_a end