Sha256: 248548999d657e9848310d7e8b5b6792e86b6b34af2abef259db6a0ddaacb7d7
Contents?: true
Size: 650 Bytes
Versions: 3
Compression:
Stored size: 650 Bytes
Contents
require "nokogiri" module AozoraPolly class Document attr_reader :title, :author, :main_text, :bibliography def self.parse(html) doc = Nokogiri::HTML.parse(html) title = doc.xpath('//h1').text author = doc.xpath('//h2').text main_text = doc.xpath('//div[@class="main_text"]').to_html bibliography = doc.xpath('//div[@class="bibliographical_information"]').to_html new(title, author, main_text, bibliography) end def initialize(title, author, main_text, bibliography) @title = title @author = author @main_text = main_text @bibliography = bibliography end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
aozora-polly-0.3.1 | lib/aozora_polly/document.rb |
aozora-polly-0.3.0 | lib/aozora_polly/document.rb |
aozora-polly-0.2.0 | lib/aozora_polly/document.rb |