Class: Markbridge::Parsers::TextFormatter::Handlers::UrlHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- Markbridge::Parsers::TextFormatter::Handlers::UrlHandler
- Defined in:
- lib/markbridge/parsers/text_formatter/handlers/url_handler.rb
Overview
Handler for URL elements in s9e/TextFormatter XML
Extracts the url attribute and creates an AST::Url node
Instance Attribute Summary collapse
-
#element_class ⇒ Object
readonly
Returns the value of attribute element_class.
Instance Method Summary collapse
-
#initialize ⇒ UrlHandler
constructor
A new instance of UrlHandler.
- #process(element:, parent:) ⇒ Object
Constructor Details
#initialize ⇒ UrlHandler
Returns a new instance of UrlHandler.
11 12 13 |
# File 'lib/markbridge/parsers/text_formatter/handlers/url_handler.rb', line 11 def initialize @element_class = AST::Url end |
Instance Attribute Details
#element_class ⇒ Object (readonly)
Returns the value of attribute element_class.
24 25 26 |
# File 'lib/markbridge/parsers/text_formatter/handlers/url_handler.rb', line 24 def element_class @element_class end |
Instance Method Details
#process(element:, parent:) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/markbridge/parsers/text_formatter/handlers/url_handler.rb', line 15 def process(element:, parent:) attrs = extract_attributes(element) node = AST::Url.new(href: attrs[:url]) parent << node # Return node to signal: process children into this node node end |