Class: OrigenDocHelpers::ListFlowFormatter
- Inherits:
-
Object
- Object
- 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.
8 9 10 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 8 def html @html end |
Instance Method Details
#close_table ⇒ Object
31 32 33 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 31 def close_table '</table>' end |
#format(node, options = {}) ⇒ Object
10 11 12 13 14 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 10 def format(node, = {}) @html = '' process(node) html end |
#on_flow(node) ⇒ Object
35 36 37 38 39 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 35 def on_flow(node) @flow ||= 0 @flow += 1 process_all(node) end |
#on_log(node) ⇒ Object
41 42 43 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 41 def on_log(node) html << "<tr><td colspan=\"6\"><strong>LOG: </strong> #{node.value}</td></tr>" end |
#on_render(node) ⇒ Object
45 46 47 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 45 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
81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 81 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
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 76 77 78 79 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 49 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['Pattern']}</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
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/origen_doc_helpers/list_flow_formatter.rb', line 16 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>Test</th>' str << '<th>Pattern</th>' str << '<th>Bin</th>' str << '<th>Softbin</th>' str << '</tr></thead>' str end |