Class: Liquid::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/liquid/tag.rb

Direct Known Subclasses

Assign, Block, Break, Continue, Cycle, Decrement, Include, Increment

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, options) ⇒ Tag



16
17
18
19
20
# File 'lib/liquid/tag.rb', line 16

def initialize(tag_name, markup, options)
  @tag_name   = tag_name
  @markup     = markup
  @options    = options
end

Instance Attribute Details

#nodelistObject (readonly)

Returns the value of attribute nodelist



4
5
6
# File 'lib/liquid/tag.rb', line 4

def nodelist
  @nodelist
end

#optionsObject

Returns the value of attribute options



3
4
5
# File 'lib/liquid/tag.rb', line 3

def options
  @options
end

#warningsObject (readonly)

Returns the value of attribute warnings



4
5
6
# File 'lib/liquid/tag.rb', line 4

def warnings
  @warnings
end

Class Method Details

.parse(tag_name, markup, tokens, options) ⇒ Object



7
8
9
10
11
# File 'lib/liquid/tag.rb', line 7

def parse(tag_name, markup, tokens, options)
  tag = new(tag_name, markup, options)
  tag.parse(tokens)
  tag
end

Instance Method Details

#blank?Boolean



33
34
35
# File 'lib/liquid/tag.rb', line 33

def blank?
  @blank || false
end

#nameObject



25
26
27
# File 'lib/liquid/tag.rb', line 25

def name
  self.class.name.downcase
end

#parse(tokens) ⇒ Object



22
23
# File 'lib/liquid/tag.rb', line 22

def parse(tokens)
end

#parse_with_selected_parser(markup) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/liquid/tag.rb', line 37

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



29
30
31
# File 'lib/liquid/tag.rb', line 29

def render(context)
  ''.freeze
end