Class: Liquid::Tag

Inherits:
Object
  • Object
show all
Includes:
ParserSwitching
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

Methods included from ParserSwitching

#parse_with_selected_parser

Constructor Details

#initialize(tag_name, markup, parse_context) ⇒ Tag

Returns a new instance of Tag.



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

def initialize(tag_name, markup, parse_context)
  @tag_name   = tag_name
  @markup     = markup
  @parse_context = parse_context
  @line_number = parse_context.line_number
end

Instance Attribute Details

#line_numberObject (readonly)

Returns the value of attribute line_number.



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

def line_number
  @line_number
end

#nodelistObject (readonly)

Returns the value of attribute nodelist.



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

def nodelist
  @nodelist
end

#parse_contextObject (readonly) Also known as: options

Returns the value of attribute parse_context.



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

def parse_context
  @parse_context
end

#tag_nameObject (readonly)

Returns the value of attribute tag_name.



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

def tag_name
  @tag_name
end

Class Method Details

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



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

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

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/liquid/tag.rb', line 39

def blank?
  false
end

#nameObject



31
32
33
# File 'lib/liquid/tag.rb', line 31

def name
  self.class.name.downcase
end

#parse(_tokens) ⇒ Object



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

def parse(_tokens)
end

#rawObject



27
28
29
# File 'lib/liquid/tag.rb', line 27

def raw
  "#{@tag_name} #{@markup}"
end

#render(_context) ⇒ Object



35
36
37
# File 'lib/liquid/tag.rb', line 35

def render(_context)
  ''.freeze
end