Class: MarkupParser
- Inherits:
-
Object
- Object
- MarkupParser
- Defined in:
- lib/Parsers/MarkupParser.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#paragraph ⇒ Object
Returns the value of attribute paragraph.
Instance Method Summary collapse
-
#initialize(html, paragraph) ⇒ MarkupParser
constructor
A new instance of MarkupParser.
- #parse ⇒ Object
Constructor Details
#initialize(html, paragraph) ⇒ MarkupParser
Returns a new instance of MarkupParser.
10 11 12 13 |
# File 'lib/Parsers/MarkupParser.rb', line 10 def initialize(html, paragraph) @body = html.search("body").first @paragraph = paragraph end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
8 9 10 |
# File 'lib/Parsers/MarkupParser.rb', line 8 def body @body end |
#paragraph ⇒ Object
Returns the value of attribute paragraph.
8 9 10 |
# File 'lib/Parsers/MarkupParser.rb', line 8 def paragraph @paragraph end |
Instance Method Details
#parse ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/Parsers/MarkupParser.rb', line 15 def parse() result = paragraph.text if paragraph.hasMarkup p = body.at_css("##{paragraph.name}") if !p.nil? result = ReverseMarkdown.convert p.inner_html end end result end |