Class: Facwparser::Element::Heading

Inherits:
ElementBase show all
Defined in:
lib/facwparser/element.rb

Instance Attribute Summary collapse

Attributes inherited from ElementBase

#children, #source

Instance Method Summary collapse

Methods inherited from ElementBase

#==, #render_text

Constructor Details

#initialize(source, level, value) ⇒ Heading

Returns a new instance of Heading.



66
67
68
69
70
# File 'lib/facwparser/element.rb', line 66

def initialize(source, level, value)
  super(source)
  @level = level
  @value = value
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



65
66
67
# File 'lib/facwparser/element.rb', line 65

def id
  @id
end

#levelObject (readonly)

Returns the value of attribute level.



64
65
66
# File 'lib/facwparser/element.rb', line 64

def level
  @level
end

#valueObject (readonly)

Returns the value of attribute value.



64
65
66
# File 'lib/facwparser/element.rb', line 64

def value
  @value
end

Instance Method Details

#render_html(options) ⇒ Object



71
72
73
74
75
76
77
78
79
# File 'lib/facwparser/element.rb', line 71

def render_html(options)
  @children = Parser.parse_value value, options

  if @id
    render_html_by_name_and_children(["h#{level}", {'id' => @id}], @children, options) + "\n"
  else
    render_html_by_name_and_children("h#{level}", @children, options) + "\n"
  end
end