Class: Markbridge::Parsers::BBCode::Handlers::AlignHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- Markbridge::Parsers::BBCode::Handlers::AlignHandler
- Defined in:
- lib/markbridge/parsers/bbcode/handlers/align_handler.rb
Overview
Handler for ALIGN tags (center, left, right, justify) Creates a generic Align element with the appropriate alignment
Instance Attribute Summary collapse
-
#element_class ⇒ Object
readonly
Returns the value of attribute element_class.
Instance Method Summary collapse
-
#initialize(alignment = nil) ⇒ AlignHandler
constructor
A new instance of AlignHandler.
- #on_open(token:, context:, registry:, tokens: nil) ⇒ Object
Methods inherited from BaseHandler
Constructor Details
#initialize(alignment = nil) ⇒ AlignHandler
Returns a new instance of AlignHandler.
10 11 12 13 |
# File 'lib/markbridge/parsers/bbcode/handlers/align_handler.rb', line 10 def initialize(alignment = nil) @alignment = alignment @element_class = AST::Align end |
Instance Attribute Details
#element_class ⇒ Object (readonly)
Returns the value of attribute element_class.
21 22 23 |
# File 'lib/markbridge/parsers/bbcode/handlers/align_handler.rb', line 21 def element_class @element_class end |
Instance Method Details
#on_open(token:, context:, registry:, tokens: nil) ⇒ Object
15 16 17 18 19 |
# File 'lib/markbridge/parsers/bbcode/handlers/align_handler.rb', line 15 def on_open(token:, context:, registry:, tokens: nil) alignment = @alignment || token.tag.downcase element = AST::Align.new(alignment:) context.push(element, token:) end |