Class: Liquid2::InlineComment
- Defined in:
- lib/liquid2/nodes/tags/inline_comment.rb
Overview
{% # comment %} style comments.
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Attributes inherited from Node
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(token, text) ⇒ InlineComment
constructor
A new instance of InlineComment.
- #render(_context, _buffer) ⇒ Object
Methods inherited from Tag
Methods inherited from Node
#block_scope, #children, #expressions, #partial_scope, #render_with_disabled_tag_check, #template_scope
Constructor Details
#initialize(token, text) ⇒ InlineComment
Returns a new instance of InlineComment.
18 19 20 21 22 23 24 |
# File 'lib/liquid2/nodes/tags/inline_comment.rb', line 18 def initialize(token, text) super(token) @text = text return unless /\n\s*[^#\s]/.match?(text) raise LiquidSyntaxError.new("every line must start with a '#'", token) end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
8 9 10 |
# File 'lib/liquid2/nodes/tags/inline_comment.rb', line 8 def text @text end |
Class Method Details
.parse(token, parser) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/liquid2/nodes/tags/inline_comment.rb', line 10 def self.parse(token, parser) comment = parser.eat(:token_comment) parser.carry_whitespace_control parser.eat(:token_tag_end) new(token, comment[1] || "") end |
Instance Method Details
#render(_context, _buffer) ⇒ Object
26 |
# File 'lib/liquid2/nodes/tags/inline_comment.rb', line 26 def render(_context, _buffer) = 0 |