Class: Facwparser::Element::ElementBase

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ ElementBase

Returns a new instance of ElementBase.



11
12
13
14
# File 'lib/facwparser/element.rb', line 11

def initialize(source)
  @source   = source
  @children = nil
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



10
11
12
# File 'lib/facwparser/element.rb', line 10

def children
  @children
end

#sourceObject (readonly)

Returns the value of attribute source.



10
11
12
# File 'lib/facwparser/element.rb', line 10

def source
  @source
end

Instance Method Details

#==(other) ⇒ Object



15
16
17
# File 'lib/facwparser/element.rb', line 15

def ==(other)
  self.class == other.class && self.source == other.source
end

#render_html(options) ⇒ Object



19
20
21
# File 'lib/facwparser/element.rb', line 19

def render_html(options)
  raise "TODO: render_html is not implemented: " + self.class.to_s + "\n"
end

#render_text(options) ⇒ Object



22
23
24
# File 'lib/facwparser/element.rb', line 22

def render_text(options)
  CGI.unescapeHTML(render_html(options).strip.gsub(/<\/?[^>]*>/, ""))
end