Class: ECFS::Document
- Inherits:
-
Object
- Object
- ECFS::Document
- Defined in:
- lib/ecfs/document.rb
Defined Under Namespace
Classes: Page
Instance Attribute Summary collapse
-
#filing ⇒ Object
readonly
Returns the value of attribute filing.
-
#pages ⇒ Object
readonly
Returns the value of attribute pages.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #full_text ⇒ Object
-
#initialize(params = {}) ⇒ Document
constructor
A new instance of Document.
Constructor Details
#initialize(params = {}) ⇒ Document
Returns a new instance of Document.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ecfs/document.rb', line 11 def initialize(params={}) @filing = params["filing"] @url = params["url"] @pages = [] io = open(@url) reader = PDF::Reader.new(io) reader.pages.each_with_index do |page, index| @pages << ECFS::Document::Page.new({ "text" => page.text, "page_number" => index + 1 }) end end |
Instance Attribute Details
#filing ⇒ Object (readonly)
Returns the value of attribute filing.
8 9 10 |
# File 'lib/ecfs/document.rb', line 8 def filing @filing end |
#pages ⇒ Object (readonly)
Returns the value of attribute pages.
7 8 9 |
# File 'lib/ecfs/document.rb', line 7 def pages @pages end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/ecfs/document.rb', line 9 def url @url end |
Instance Method Details
#full_text ⇒ Object
25 26 27 |
# File 'lib/ecfs/document.rb', line 25 def full_text @pages.map {|p| p.text}.join(",") end |