Class: Neo4j::AsciidoctorExtensions::AttributeUpdateTreeProcessor
- Inherits:
-
Extensions::TreeProcessor
- Object
- Extensions::TreeProcessor
- Neo4j::AsciidoctorExtensions::AttributeUpdateTreeProcessor
- Defined in:
- lib/neo4j/asciidoctor/extensions/attribute_update/extension.rb
Overview
A tree processor that update an attribute depending on a given rule.
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#process(document) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/neo4j/asciidoctor/extensions/attribute_update/extension.rb', line 15 def process(document) if (attribute_name = @config[:attr_name]) && (current_value = document.attr attribute_name) && (update_rule = @config[:update_rule]) new_value = update_rule.call(document, current_value) document.set_attr attribute_name, new_value if new_value != current_value end document end |