module SheepAst::NodeOperation

Aggregates User interface of sheep_ast library

@api public

Public Instance Methods

focus_on(name) click to toggle source
# File lib/sheep_ast/analyzer_core/node_operation.rb, line 28
def focus_on(name)
  @focus = name
  return self
end
move_focused_node(dir) click to toggle source
# File lib/sheep_ast/analyzer_core/node_operation.rb, line 34
def move_focused_node(dir)
  move_node(@focus, dir)
end
move_node(name, dir) click to toggle source
# File lib/sheep_ast/analyzer_core/node_operation.rb, line 39
def move_node(name, dir)
  a_stage = stage(name)
  case dir
  when OperateNode::Up
    parent_node = a_stage.current_node.parent_node
    node_info = NodeInfo.new
    node_info.node_id = T.must(parent_node).my_id
    a_stage.move_node(node_info)
  when OperateNode::Revert
    a_stage.move_committed_node
  when OperateNode::Commit
    a_stage.commit_node
  when OperateNode::Top
    node_info = NodeInfo.new
    node_info.node_id = 0 # root node id
    a_stage.move_node(node_info)
  end
end
next_command() click to toggle source
# File lib/sheep_ast/analyzer_core/node_operation.rb, line 18
def next_command
  if @focus.nil?
    ldebug? and ldebug 'Need forcus_on to point ast manager to use this function'
    return []
  end

  current_node(@focus).next_command
end

Private Instance Methods

current_node(name) click to toggle source
# File lib/sheep_ast/analyzer_core/node_operation.rb, line 61
def current_node(name)
  return @stage_manager.stage_get(name).current_node
end