Class: Liquid::Tag
- Inherits:
-
Object
- Object
- Liquid::Tag
- Defined in:
- lib/liquid/tag.rb
Direct Known Subclasses
Assign, Block, Break, Continue, Cycle, Decrement, DefaultContent, Include, Increment
Instance Attribute Summary collapse
-
#line ⇒ Object
Returns the value of attribute line.
-
#nodelist ⇒ Object
Returns the value of attribute nodelist.
-
#options ⇒ Object
Returns the value of attribute options.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Class Method Summary collapse
Instance Method Summary collapse
- #blank? ⇒ Boolean
-
#initialize(tag_name, markup, tokens, options) ⇒ Tag
constructor
A new instance of Tag.
- #name ⇒ Object
- #parse(tokens) ⇒ Object
- #parse_with_selected_parser(markup) ⇒ Object
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, markup, tokens, options) ⇒ Tag
Returns a new instance of Tag.
15 16 17 18 19 20 21 |
# File 'lib/liquid/tag.rb', line 15 def initialize(tag_name, markup, tokens, ) @tag_name = tag_name @markup = markup @options = || {} @line = @options[:line] || 1 parse(tokens) end |
Instance Attribute Details
#line ⇒ Object
Returns the value of attribute line.
3 4 5 |
# File 'lib/liquid/tag.rb', line 3 def line @line end |
#nodelist ⇒ Object
Returns the value of attribute nodelist.
3 4 5 |
# File 'lib/liquid/tag.rb', line 3 def nodelist @nodelist end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/liquid/tag.rb', line 3 def @options end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
4 5 6 |
# File 'lib/liquid/tag.rb', line 4 def warnings @warnings end |
Class Method Details
.new_with_options(tag_name, markup, tokens, options) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/liquid/tag.rb', line 6 def self.(tag_name, markup, tokens, ) # Forgive me Matz for I have sinned. I know this code is weird # but it was necessary to maintain API compatibility. new_tag = self.allocate new_tag. = new_tag.send(:initialize, tag_name, markup, tokens, ) new_tag end |
Instance Method Details
#blank? ⇒ Boolean
34 35 36 |
# File 'lib/liquid/tag.rb', line 34 def blank? @blank || true end |
#name ⇒ Object
26 27 28 |
# File 'lib/liquid/tag.rb', line 26 def name self.class.name.downcase end |
#parse(tokens) ⇒ Object
23 24 |
# File 'lib/liquid/tag.rb', line 23 def parse(tokens) end |
#parse_with_selected_parser(markup) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/liquid/tag.rb', line 38 def parse_with_selected_parser(markup) case @options[:error_mode] || Template.error_mode when :strict then strict_parse_with_error_context(markup) when :lax then lax_parse(markup) when :warn begin return strict_parse_with_error_context(markup) rescue SyntaxError => e @warnings ||= [] @warnings << e return lax_parse(markup) end end end |
#render(context) ⇒ Object
30 31 32 |
# File 'lib/liquid/tag.rb', line 30 def render(context) '' end |