Class: Facwparser::Element::List

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(type) ⇒ List

Returns a new instance of List.



83
84
85
86
# File 'lib/facwparser/element.rb', line 83

def initialize(type)
  super('')
  @type = type
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



82
83
84
# File 'lib/facwparser/element.rb', line 82

def type
  @type
end

Instance Method Details

#push(item) ⇒ Object



87
88
89
90
91
# File 'lib/facwparser/element.rb', line 87

def push(item)
  @children ||= []
  @children.push(item)
  self
end

#render_html(options) ⇒ Object



92
93
94
# File 'lib/facwparser/element.rb', line 92

def render_html(options)
  (render_html_by_name_and_children(@type == '#' ? 'ol' : 'ul', @children, options, "\n", "\n") + "\n").gsub("\n\n", "\n")
end