class Async::Debug::ReactorView
Public Class Methods
new(id, **data)
click to toggle source
Calls superclass method
# File lib/async/debug/reactor_view.rb, line 28 def initialize(id, **data) super @update = nil @top = Async::Task.current.reactor end
Public Instance Methods
bind(page)
click to toggle source
Calls superclass method
# File lib/async/debug/reactor_view.rb, line 35 def bind(page) super(page) @update = Async do |task| while true task.sleep(1.0/10.0) self.replace! end end end
close()
click to toggle source
Calls superclass method
# File lib/async/debug/reactor_view.rb, line 46 def close @update.stop super end
handle(event, details)
click to toggle source
# File lib/async/debug/reactor_view.rb, line 52 def handle(event, details) replace! end
render(builder)
click to toggle source
# File lib/async/debug/reactor_view.rb, line 90 def render(builder) builder.tag :div, class: 'tree' do builder.tag :ul do builder.inline :li do render_node(builder) end end end end
render_node(builder, node = @top)
click to toggle source
# File lib/async/debug/reactor_view.rb, line 56 def render_node(builder, node = @top) klass = [] title = [] if node.respond_to?(:status) klass << node.status end if node.transient? klass << "transient" end if node.respond_to?(:backtrace) if backtrace = node.backtrace title = backtrace.first(8) end end builder.inline :span, class: klass.join(' '), title: title.join("\n") do text = node.annotation || "#{node.class} 0x#{node.object_id.to_s(16)}" builder.text(text) end if node.children builder.tag :ul do node.children.each do |child| builder.inline :li do render_node(builder, child) end end end end end