Class: Markbridge::Parsers::BBCode::Handlers::UrlHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- Markbridge::Parsers::BBCode::Handlers::UrlHandler
- Defined in:
- lib/markbridge/parsers/bbcode/handlers/url_handler.rb
Overview
Handler for URL tags
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.
- #on_open(token:, context:, registry:, tokens: nil) ⇒ Object
Methods inherited from BaseHandler
Constructor Details
#initialize ⇒ UrlHandler
Returns a new instance of UrlHandler.
9 10 11 |
# File 'lib/markbridge/parsers/bbcode/handlers/url_handler.rb', line 9 def initialize @element_class = AST::Url end |
Instance Attribute Details
#element_class ⇒ Object (readonly)
Returns the value of attribute element_class.
19 20 21 |
# File 'lib/markbridge/parsers/bbcode/handlers/url_handler.rb', line 19 def element_class @element_class end |
Instance Method Details
#on_open(token:, context:, registry:, tokens: nil) ⇒ Object
13 14 15 16 17 |
# File 'lib/markbridge/parsers/bbcode/handlers/url_handler.rb', line 13 def on_open(token:, context:, registry:, tokens: nil) href = token.attrs[:href] || token.attrs[:url] || token.attrs[:option] element = AST::Url.new(href:) context.push(element, token:) end |