Class: OrigenDocHelpers::ListFlowFormatter
- Inherits:
-
ATP::Formatter
- Object
- ATP::Formatter
- OrigenDocHelpers::ListFlowFormatter
- Defined in:
- lib/origen_doc_helpers/list_flow_formatter.rb
Instance Attribute Summary collapse
-
#html ⇒ Object
readonly
Returns the value of attribute html.
Instance Method Summary collapse
- #close_table ⇒ Object
- #format(node, options = {}) ⇒ Object
- #on_flow(node) ⇒ Object
- #on_log(node) ⇒ Object
- #on_render(node) ⇒ Object
- #on_set_result(node) ⇒ Object
- #on_test(node) ⇒ Object
- #open_table ⇒ Object
Instance Attribute Details
#html ⇒ Object (readonly)
Returns the value of attribute html.
4 5 6 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 4 def html @html end |
Instance Method Details
#close_table ⇒ Object
27 28 29 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 27 def close_table '</table>' end |
#format(node, options = {}) ⇒ Object
6 7 8 9 10 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 6 def format(node, = {}) @html = '' process(node) html end |
#on_flow(node) ⇒ Object
31 32 33 34 35 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 31 def on_flow(node) @flow ||= 0 @flow += 1 process_all(node) end |
#on_log(node) ⇒ Object
37 38 39 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 37 def on_log(node) html << "<tr><td colspan=\"6\"><strong>LOG: </strong> #{node.value}</td></tr>" end |
#on_render(node) ⇒ Object
41 42 43 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 41 def on_render(node) html << "<tr><td colspan=\"6\"><strong>RENDER: </strong> An expicitly rendered flow snippet occurs here</td></tr>" end |
#on_set_result(node) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 77 def on_set_result(node) html << '<tr>' html << '<td></td>' if node.to_a[0] == 'pass' html << '<td>PASS</td>' else html << '<td>FAIL</td>' end html << '<td></td>' html << '<td></td>' html << "<td>#{node.find(:bin).try(:value)}</td>" html << "<td>#{node.find(:softbin).try(:value)}</td>" html << '</tr>' end |
#on_test(node) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 45 def on_test(node) id = node.find(:id).value html << "<tr id=\"list_#{@flow}_test_#{id}\" class=\"list-test-line clickable\" data-testid=\"flow_#{@flow}_test_#{id}\">" html << "<td>#{node.find(:number).try(:value)}</td>" if node.find(:failed) html << '<td>FAIL</td>' else html << '<td>PASS</td>' end if n = node.find(:name) name = n.value else name = node.find(:object).value['Test'] end html << "<td>#{name}</td>" html << "<td>#{node.find(:object).value['Test']}</td>" if (f1 = node.find(:on_fail)) && (r1 = f1.find(:set_result)) && (b1 = r1.find(:bin)) html << "<td>B#{b1.value}</td>" else html << '<td></td>' end if (f2 = node.find(:on_fail)) && (r2 = f2.find(:set_result)) && (b2 = r2.find(:softbin)) html << "<td>S#{b2.value}</td>" else html << '<td></td>' end html << '</tr>' end |
#open_table ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 12 def open_table str = '' # str << "<table class=\"table table-striped\">" str << "<table class=\"table table-hover\">" str << '<thead><tr>' str << '<th>Number</th>' str << '<th>Result</th>' str << '<th>Name</th>' str << '<th>Test</th>' str << '<th>Bin</th>' str << '<th>Softbin</th>' str << '</tr></thead>' str end |