Class: AozoraSsml::Document
- Inherits:
-
Object
- Object
- AozoraSsml::Document
- Defined in:
- lib/aozora-ssml/document.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#main_text ⇒ Object
readonly
Returns the value of attribute main_text.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(title, author, main_text) ⇒ Document
constructor
A new instance of Document.
Constructor Details
#initialize(title, author, main_text) ⇒ Document
Returns a new instance of Document.
15 16 17 18 19 |
# File 'lib/aozora-ssml/document.rb', line 15 def initialize(title, , main_text) @title = title @author = @main_text = main_text end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
5 6 7 |
# File 'lib/aozora-ssml/document.rb', line 5 def @author end |
#main_text ⇒ Object (readonly)
Returns the value of attribute main_text.
5 6 7 |
# File 'lib/aozora-ssml/document.rb', line 5 def main_text @main_text end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/aozora-ssml/document.rb', line 5 def title @title end |
Class Method Details
.parse(html) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/aozora-ssml/document.rb', line 7 def self.parse(html) doc = Nokogiri::HTML.parse(html) title = doc.xpath('//h1').text = doc.xpath('//h2').text main_text = doc.xpath('//div[@class="main_text"]').to_html new(title, , main_text) end |