Class: Teek::UI::TreeInspector::Event

Inherits:
Data
  • Object
show all
Defined in:
lib/teek/ui/tree_inspector.rb

Overview

One recorded moment of tree assembly - see #log.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actionSymbol

Returns +:push+/+:pop+ (the build stack, see WidgetDSL#current_path) or :append (a node added via Node#add_child).

Returns:



23
24
25
26
27
28
29
30
31
# File 'lib/teek/ui/tree_inspector.rb', line 23

Event = Data.define(:action, :node, :path) do
  def to_s
    case action
    when :push then "-> #{path}"
    when :pop then "<- #{path}"
    when :append then "+  #{node.display_name} (under #{path})"
    end
  end
end

#nodeNode

Returns the node pushed/popped/appended.

Returns:

  • (Node)

    the node pushed/popped/appended



23
24
25
26
27
28
29
30
31
# File 'lib/teek/ui/tree_inspector.rb', line 23

Event = Data.define(:action, :node, :path) do
  def to_s
    case action
    when :push then "-> #{path}"
    when :pop then "<- #{path}"
    when :append then "+  #{node.display_name} (under #{path})"
    end
  end
end

#pathString

Returns for +:push+/+:pop+, the full ancestry breadcrumb this node had while on top of the stack; for :append, its new parent's own Node#display_name.

Returns:

  • (String)

    for +:push+/+:pop+, the full ancestry breadcrumb this node had while on top of the stack; for :append, its new parent's own Node#display_name



23
24
25
26
27
28
29
30
31
# File 'lib/teek/ui/tree_inspector.rb', line 23

Event = Data.define(:action, :node, :path) do
  def to_s
    case action
    when :push then "-> #{path}"
    when :pop then "<- #{path}"
    when :append then "+  #{node.display_name} (under #{path})"
    end
  end
end

Instance Method Details

#to_sObject



24
25
26
27
28
29
30
# File 'lib/teek/ui/tree_inspector.rb', line 24

def to_s
  case action
  when :push then "-> #{path}"
  when :pop then "<- #{path}"
  when :append then "+  #{node.display_name} (under #{path})"
  end
end