class Oplogjam::Operators::Intermediate

Attributes

path[R]
tree[R]

Public Class Methods

new(path, tree = {}) click to toggle source
# File lib/oplogjam/operators/intermediate.rb, line 6
def initialize(path, tree = {})
  @path = path
  @tree = tree
end

Public Instance Methods

nodes() click to toggle source
# File lib/oplogjam/operators/intermediate.rb, line 42
def nodes
  tree.values
end
populate(path) click to toggle source
# File lib/oplogjam/operators/intermediate.rb, line 11
def populate(path)
  if path.last =~ NUMERIC_INDEX
    populate_index(path)
  else
    populate_field(path)
  end
end
populate_field(path) click to toggle source
# File lib/oplogjam/operators/intermediate.rb, line 27
def populate_field(path)
  tree[path] ||= IntermediateField.new(path)
end
populate_index(path) click to toggle source
# File lib/oplogjam/operators/intermediate.rb, line 31
def populate_index(path)
  tree[path] ||= IntermediateIndex.new(path)
end
set(path, value) click to toggle source
# File lib/oplogjam/operators/intermediate.rb, line 19
def set(path, value)
  if path.last =~ NUMERIC_INDEX
    set_index(path, value)
  else
    set_field(path, value)
  end
end
set_field(path, value) click to toggle source
# File lib/oplogjam/operators/intermediate.rb, line 34
def set_field(path, value)
  tree[path] = FieldAssignment.new(path, value)
end
set_index(path, value) click to toggle source
# File lib/oplogjam/operators/intermediate.rb, line 38
def set_index(path, value)
  tree[path] = IndexAssignment.new(path, value)
end