Class: ActiverecordCallbackLens::Renderer::ConditionTreeHtml
- Inherits:
-
Object
- Object
- ActiverecordCallbackLens::Renderer::ConditionTreeHtml
- Defined in:
- lib/activerecord_callback_lens/renderer/html_renderer.rb
Overview
Renders a single ConditionTree node (and its descendants) as nested <ul> markup, and exposes the flat list of leaf condition names. Extracted from HtmlRenderer so the recursive tree handling is a single, testable responsibility separate from page assembly.
All names are HTML escaped via CGI.escapeHTML so values containing <, > or & cannot break the surrounding markup.
Constant Summary collapse
- Tree =
Parser::ConditionTree
Instance Method Summary collapse
-
#initialize(node) ⇒ ConditionTreeHtml
constructor
A new instance of ConditionTreeHtml.
-
#names ⇒ Array<String>
Leaf names (predicate + method refs), depth-first.
-
#to_html ⇒ String
Nested <ul> markup for the node.
Constructor Details
#initialize(node) ⇒ ConditionTreeHtml
Returns a new instance of ConditionTreeHtml.
23 24 25 |
# File 'lib/activerecord_callback_lens/renderer/html_renderer.rb', line 23 def initialize(node) @node = node end |
Instance Method Details
#names ⇒ Array<String>
Returns leaf names (predicate + method refs), depth-first.
33 34 35 |
# File 'lib/activerecord_callback_lens/renderer/html_renderer.rb', line 33 def names leaf_names(@node) end |
#to_html ⇒ String
Returns nested <ul> markup for the node.
28 29 30 |
# File 'lib/activerecord_callback_lens/renderer/html_renderer.rb', line 28 def to_html render(@node) end |