Class: ConfluencePage
- Inherits:
-
Object
- Object
- ConfluencePage
- Defined in:
- lib/confluence_page.rb
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(response) ⇒ ConfluencePage
constructor
A new instance of ConfluencePage.
- #title ⇒ Object
Constructor Details
#initialize(response) ⇒ ConfluencePage
Returns a new instance of ConfluencePage.
5 6 7 |
# File 'lib/confluence_page.rb', line 5 def initialize(response) @doc = Nokogiri(response) end |
Instance Method Details
#content ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/confluence_page.rb', line 13 def content content = CGI.unescapeHTML @doc.css('#markupTextarea').text content.gsub!(' ', ' ') # remove the double pipes used for table headers in Confluence content.gsub!('||', '|') # remove other noise content.gsub!("\r\n", "\n") content.gsub!("\\\\\n", '') content.gsub!('\\', '') # remove any unwanted headers content.gsub!(/h\d\. (Scenario: .*)/, '\1') content.gsub!(/h\d\. (Scenario Outline: .*)/, '\1') content.gsub!(/h\d\. (Background: .*)/, '\1') #Remove fancy quotes content.gsub!('’', "'") content.gsub!('‘', "'") content.gsub!('“', '"') content.gsub!('”', '"') content.gsub!(/^#(.*)/, '-' + '\1') content end |
#title ⇒ Object
9 10 11 |
# File 'lib/confluence_page.rb', line 9 def title @doc.at('#content-title')[:value] end |