class Oplogjam::Operators::Unset
Attributes
unsets[R]
Public Class Methods
from(operation)
click to toggle source
# File lib/oplogjam/operators/unset.rb, line 7 def self.from(operation) operation.each_with_object(new) do |(dotted_path, _), unset| path = dotted_path.split(FIELD_SEPARATOR) if path.last =~ NUMERIC_INDEX unset.unset_index(path) else unset.unset_field(path) end end end
new(unsets = [])
click to toggle source
# File lib/oplogjam/operators/unset.rb, line 21 def initialize(unsets = []) @unsets = unsets end
Public Instance Methods
delete(column)
click to toggle source
# File lib/oplogjam/operators/unset.rb, line 33 def delete(column) unsets.inject(column) do |subject, unset| unset.delete(subject) end end
unset_field(path)
click to toggle source
# File lib/oplogjam/operators/unset.rb, line 25 def unset_field(path) unsets << UnsetField.new(path) end
unset_index(path)
click to toggle source
# File lib/oplogjam/operators/unset.rb, line 29 def unset_index(path) unsets << UnsetIndex.new(path) end