class Object
Public Instance Methods
add_history(node)
click to toggle source
# File bin/xml-explorer, line 36 def add_history(node) history = [node] history << history.last.parent until history.last.parent.is_a? Oga::XML::Document history_window.clear history.reverse.each do |n| history_window.button("#{n.name} #{n.attributes.map(&:to_xml).join(" ")}") do display(n) end end end
display(node)
click to toggle source
# File bin/xml-explorer, line 53 def display(node) add_history(node) node_window.clear node_window.markdown("# #{node.name}") node_window.table node.attributes.map{|a| [a.name.to_s.light_magenta, a.value]} node_window.input("CSS", history:true) do |m| node_window.subpane("buttons").clear node.css(m['text']).each {|n| add_button(n) } end node.element_children.each {|n| add_button(n) } end
f()
click to toggle source
# File bin/xml-explorer, line 8 def f; $f; end
history_window()
click to toggle source
# File bin/xml-explorer, line 12 def history_window; f.pane("history", weight: 0.15);end
node_window()
click to toggle source
# File bin/xml-explorer, line 10 def node_window; f.pane("nodewindow", weight: 0.85); end
run(task)
click to toggle source
# File bin/frake, line 11 def run(task) f2 = Flammarion::Engraving.new f2.title task f2.puts "Running #{task.light_magenta}" Open3.popen3(task) do |i,o,e,t| Thread.new {e.each_line{|l| f2.print l.red}} o.each_line {|l| f2.print l} f2.status t.value.success? ? "Done!".light_green : "Failed!".light_red end end