Class: Markbridge::Parsers::HTML::Handlers::SimpleHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- Markbridge::Parsers::HTML::Handlers::SimpleHandler
- Defined in:
- lib/markbridge/parsers/html/handlers/simple_handler.rb
Overview
Simple formatting handlers that create an element and process children
Direct Known Subclasses
Instance Attribute Summary collapse
-
#element_class ⇒ Object
readonly
Returns the value of attribute element_class.
Instance Method Summary collapse
-
#initialize(element_class) ⇒ SimpleHandler
constructor
A new instance of SimpleHandler.
- #process(element:, parent:) ⇒ Object
Constructor Details
#initialize(element_class) ⇒ SimpleHandler
Returns a new instance of SimpleHandler.
9 10 11 |
# File 'lib/markbridge/parsers/html/handlers/simple_handler.rb', line 9 def initialize(element_class) @element_class = element_class end |
Instance Attribute Details
#element_class ⇒ Object (readonly)
Returns the value of attribute element_class.
21 22 23 |
# File 'lib/markbridge/parsers/html/handlers/simple_handler.rb', line 21 def element_class @element_class end |
Instance Method Details
#process(element:, parent:) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/markbridge/parsers/html/handlers/simple_handler.rb', line 13 def process(element:, parent:) ast_element = @element_class.new parent << ast_element # Return element to signal: process children into this element ast_element end |