Class: Tumblargh::Node::Tag

Inherits:
Base
  • Object
show all
Defined in:
lib/tumblargh/node/tag.rb

Instance Method Summary collapse

Methods inherited from Base

#to_s

Instance Method Details

#nameObject



22
23
24
# File 'lib/tumblargh/node/tag.rb', line 22

def name
  elements[1].text_value
end

#to_treeObject



26
27
28
# File 'lib/tumblargh/node/tag.rb', line 26

def to_tree
  return [type, name]
end

#typeObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/tumblargh/node/tag.rb', line 5

def type
  return @type if defined?(@type)

  n = name.split(':')
  if n.size == 2
    @type = "#{n.first.camelize.to_sym}Tag"

    if @type == 'BlockTag'
      raise ParserError, "There's an unclosed block somewhere near `#{name}`"
    end

    @type
  else
    super
  end
end