Class: Himl::Parser::Document::Tag

Inherits:
Struct
  • Object
show all
Defined in:
lib/himl/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#block_endObject

Returns the value of attribute block_end

Returns:

  • (Object)

    the current value of block_end



8
9
10
# File 'lib/himl/parser.rb', line 8

def block_end
  @block_end
end

#indentationObject

Returns the value of attribute indentation

Returns:

  • (Object)

    the current value of indentation



8
9
10
# File 'lib/himl/parser.rb', line 8

def indentation
  @indentation
end

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



8
9
10
# File 'lib/himl/parser.rb', line 8

def line
  @line
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



8
9
10
# File 'lib/himl/parser.rb', line 8

def name
  @name
end

Instance Method Details

#block_start=(start) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/himl/parser.rb', line 25

def block_start=(start)
  self.block_end = case start
  when 'do'
    'end'
  when '{'
    '}'
  end
end

#end_tagObject



9
10
11
12
13
14
15
# File 'lib/himl/parser.rb', line 9

def end_tag
  if has_block?
    "#{' ' * indentation}<% #{block_end} %>\n"
  else
    "#{' ' * indentation}</#{name}>\n"
  end
end

#erb_tag?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/himl/parser.rb', line 17

def erb_tag?
  name == ERB_TAG
end

#has_block?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/himl/parser.rb', line 21

def has_block?
  block_end
end