Class: Koziolekweb::Tags::Offtop
- Inherits:
-
Liquid::Block
- Object
- Liquid::Block
- Koziolekweb::Tags::Offtop
- Defined in:
- lib/jekyll/koziolekweb/tags.rb
Constant Summary collapse
- VALID_DIRECTIONS =
%w[right left].freeze
Instance Method Summary collapse
-
#initialize(tag_name, markup, tokens) ⇒ Offtop
constructor
A new instance of Offtop.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, markup, tokens) ⇒ Offtop
Returns a new instance of Offtop.
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/jekyll/koziolekweb/tags.rb', line 57 def initialize(tag_name, markup, tokens) super @params = parse_params(markup) @direction = @params.fetch('direction', 'right').strip unless self.class::VALID_DIRECTIONS.include?(@direction) raise ArgumentError, "Invalid direction '#{@direction}'. Allowed values are: #{VALID_DIRECTIONS.join(', ')}" end end |
Instance Method Details
#render(context) ⇒ Object
68 69 70 71 |
# File 'lib/jekyll/koziolekweb/tags.rb', line 68 def render(context) content = super "<aside class=\"offtopic f-#{@direction}\">#{content}</aside>" end |