Module: Whitepaper
- Defined in:
- lib/whitepaper.rb,
lib/whitepaper/cli.rb,
lib/whitepaper/paper.rb,
lib/whitepaper/version.rb,
lib/whitepaper/engine/acm.rb,
lib/whitepaper/engine/google.rb,
lib/whitepaper/engine/citeseerx.rb,
lib/whitepaper/engine/ieeexplore.rb
Overview
The main module encapsulating Whitepaper resources.
Defined Under Namespace
Modules: Engine Classes: CLI, Paper
Constant Summary collapse
- VERSION =
Version number for Whitepaper gem.
"0.0.4"
Class Method Summary collapse
-
.download_pdf_by_title(title) ⇒ Object
Downloads the first available pdf by searching for a partial match with the given title.
-
.find_authors_by_title(title) ⇒ Object
Find and return a list of authors by searching for a partial match with the given title.
-
.find_by_title(title) ⇒ Object
Find and return a Whitepaper::Paper by searching for a partial match with the given title.
-
.find_pdfs_by_title(title) ⇒ Object
Find and return a list of pdf urls by searching for a partial match with the given title.
-
.find_title_by_title(title) ⇒ Object
Find and return the proper title by searching for a partial match with the given title.
Class Method Details
.download_pdf_by_title(title) ⇒ Object
Downloads the first available pdf by searching for a partial match with the given title. The name of the file will be the title of the paper.
74 75 76 77 |
# File 'lib/whitepaper.rb', line 74 def download_pdf_by_title(title) paper = find_by_title(title) paper.download end |
.find_authors_by_title(title) ⇒ Object
Find and return a list of authors by searching for a partial match with the given title.
46 47 48 49 50 51 52 |
# File 'lib/whitepaper.rb', line 46 def (title) paper = find_by_title(title) if paper paper. end end |
.find_by_title(title) ⇒ Object
Find and return a Whitepaper::Paper by searching for a partial match with the given title.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/whitepaper.rb', line 16 def find_by_title(title) paper_csx = Engine::CiteSeerX.find_by_title(title) paper_acm = Engine::ACM.find_by_title(title) paper_i3e = Engine::IEEEXplore.find_by_title(title) papers = [] papers << paper_csx if paper_csx papers << paper_acm if paper_acm papers << paper_i3e if paper_i3e paper = papers.sort{|a,b| b.score_by_title(title) <=> a.score_by_title(title)}.first # Gather pdf and ps links across the open internet g = Engine::Google.find_by_title(title) return g if paper.nil? paper = Paper.new(paper.title, paper., {:description => paper.description, :keywords => paper.keywords, :year => paper.year, :conference => paper.conference, :pdf_urls => paper.pdf_urls.concat(g.pdf_urls), :ps_urls => paper.ps_urls.concat(g.ps_urls)}) paper end |
.find_pdfs_by_title(title) ⇒ Object
Find and return a list of pdf urls by searching for a partial match with the given title.
64 65 66 67 68 69 70 |
# File 'lib/whitepaper.rb', line 64 def find_pdfs_by_title(title) paper = find_by_title(title) if paper paper.pdf_urls end end |
.find_title_by_title(title) ⇒ Object
Find and return the proper title by searching for a partial match with the given title.
55 56 57 58 59 60 61 |
# File 'lib/whitepaper.rb', line 55 def find_title_by_title(title) paper = find_by_title(title) if paper paper.title end end |