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

- (Tag) initialize(tag_name, markup, options)

Returns a new instance of 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

- (Object) nodelist (readonly)

Returns the value of attribute nodelist



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

def nodelist
  @nodelist
end

- (Object) options

Returns the value of attribute options



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

def options
  @options
end

- (Object) warnings (readonly)

Returns the value of attribute warnings



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

def warnings
  @warnings
end

Class Method Details

+ (Object) parse(tag_name, markup, tokens, options)



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

- (Boolean) blank?

Returns:

  • (Boolean)


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

def blank?
  @blank || false
end

- (Object) name



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

def name
  self.class.name.downcase
end

- (Object) parse(tokens)



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

def parse(tokens)
end

- (Object) parse_with_selected_parser(markup)



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

- (Object) render(context)



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

def render(context)
  ''.freeze
end