Class: Facwparser::Element::ElementBase
- Inherits:
-
Object
- Object
- Facwparser::Element::ElementBase
- Defined in:
- lib/facwparser/element.rb
Direct Known Subclasses
Heading, HorizontalRule, InlineElementBase, List, ListItem, MacroBase, P, Table, TableRow
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(source) ⇒ ElementBase
constructor
A new instance of ElementBase.
- #render_html(options) ⇒ Object
- #render_text(options) ⇒ Object
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
#children ⇒ Object (readonly)
Returns the value of attribute children.
10 11 12 |
# File 'lib/facwparser/element.rb', line 10 def children @children end |
#source ⇒ Object (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() 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() CGI.unescapeHTML(render_html().strip.gsub(/<\/?[^>]*>/, "")) end |