Class: Locomotive::Steam::Liquid::Tags::Hybrid
- Inherits:
-
Liquid::Block
- Object
- Liquid::Block
- Locomotive::Steam::Liquid::Tags::Hybrid
- Defined in:
- lib/locomotive/steam/liquid/tags/hybrid.rb
Direct Known Subclasses
Instance Method Summary collapse
- #find_block_delimiter?(tokenizer) ⇒ Boolean
- #nodelist ⇒ Object
- #parse(tokens) ⇒ Object
- #render_as_block? ⇒ Boolean
Instance Method Details
#find_block_delimiter?(tokenizer) ⇒ Boolean
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/locomotive/steam/liquid/tags/hybrid.rb', line 21 def find_block_delimiter?(tokenizer) tokenizer.instance_variable_get(:@tokens).each do |token| next if token.empty? if token.start_with?(::Liquid::BlockBody::TAGSTART) if token =~ ::Liquid::BlockBody::FullToken return false if Regexp.last_match(1) == @tag_name return true if Regexp.last_match(1) == block_delimiter end end end false end |
#nodelist ⇒ Object
34 35 36 |
# File 'lib/locomotive/steam/liquid/tags/hybrid.rb', line 34 def nodelist @body&.nodelist || [] end |
#parse(tokens) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/locomotive/steam/liquid/tags/hybrid.rb', line 12 def parse(tokens) if @render_as_block = find_block_delimiter?(tokens) super else @body = nil @blank = false end end |
#render_as_block? ⇒ Boolean
8 9 10 |
# File 'lib/locomotive/steam/liquid/tags/hybrid.rb', line 8 def render_as_block? @render_as_block end |