class Orchestrate::KeyValue::OperationSet

An object which builds a set of operations for manipulating an Orchestrate::KeyValue

Attributes

key_value[R]

@return [KeyValue] The keyvalue this object will manipulate.

operations[R]

@return operations to be performed.

Public Class Methods

new(key_value, operations=[]) click to toggle source

Initialize a new OperationSet object @param key_value [Orchestrate::KeyValue] The keyvalue to manipulate.

# File lib/orchestrate/key_value.rb, line 340
def initialize(key_value, operations=[])
  @key_value = key_value
  @operations = operations
end

Public Instance Methods

add(path, value) click to toggle source
# File lib/orchestrate/key_value.rb, line 349
def add(path, value)
  self.class.new(key_value, operations.push({op: "add", path: "#{path}", value: value}))
end
copy(from_path, to_path) click to toggle source
# File lib/orchestrate/key_value.rb, line 365
def copy(from_path, to_path)
  self.class.new(key_value, operations.push({op: "copy", from: "#{from_path}", path: "#{to_path}"}))
end
dec(path, amount)
Alias for: decrement
decrement(path, amount) click to toggle source
# File lib/orchestrate/key_value.rb, line 374
def decrement(path, amount)
  self.class.new(key_value, operations.push({op: "inc", path: "#{path}", value: -amount}))
end
Also aliased as: dec
inc(path, amount)
Alias for: increment
increment(path, amount) click to toggle source
# File lib/orchestrate/key_value.rb, line 369
def increment(path, amount)
  self.class.new(key_value, operations.push({op: "inc", path: "#{path}", value: amount}))
end
Also aliased as: inc
move(from_path, to_path) click to toggle source
# File lib/orchestrate/key_value.rb, line 361
def move(from_path, to_path)
  self.class.new(key_value, operations.push({op: "move", from: "#{from_path}", path: "#{to_path}"}))
end
remove(path) click to toggle source
# File lib/orchestrate/key_value.rb, line 353
def remove(path)
  self.class.new(key_value, operations.push({op: "remove", path: "#{path}"}))
end
replace(path, value) click to toggle source
# File lib/orchestrate/key_value.rb, line 357
def replace(path, value)
  self.class.new(key_value, operations.push({op: "replace", path: "#{path}", value: value}))
end
test(path, value) click to toggle source
# File lib/orchestrate/key_value.rb, line 379
def test(path, value)
  self.class.new(key_value, operations.push({op: "test", path: "#{path}", value: value}))
end
update(ref=nil) click to toggle source
# File lib/orchestrate/key_value.rb, line 345
def update(ref=nil)
  key_value.perform(:patch, operations, ref)
end