Class: Philologic::Client::Bibliography

Inherits:
Response
  • Object
show all
Defined in:
lib/philologic-client/bibliography.rb

Overview

Bibliography response returned by bibliography report.

Extends Philologic::Client::Response

Usage

# <div class='philologic_response'>
#   <p class='description'>Bibliography Report: 42 results.</p>
#   <ol class='philologic_cite_list'>
#     <li class='philologic_occurrence'>
#       <a href="./1/0/0/0/0" class='philologic_cite'>
#         <span class='philologic_property' title='author'>William Shakespeare</span>,
#         <i>
#           <span class='philologic_cite' title='title'>
#             The First Part of King Henry the Fourth
#           </span>
#         </i>
#         :
#         <span class='philologic_property' title='who'></span>
#       </a>
#    </li>
#    ...
#   </ol>
# </div>
biblio = Philologic::Client::Bibliography.new(html)
biblio.titles.each do |title|
  ... Philologic::Client::Occurrence object ...
end

Instance Attribute Summary collapse

Attributes inherited from Response

#client

Instance Method Summary collapse

Methods inherited from Response

#[], #each, #keys

Constructor Details

#initialize(document, client = nil) ⇒ Bibliography

Initialize Philologic::Client::Bibliography object.

Params:

document

Nokogiri document

client

(optional) Philologic::Client object or nil



49
50
51
52
53
54
# File 'lib/philologic-client/bibliography.rb', line 49

def initialize(document, client = nil)
  super

  @properties = {} # TODO Sigh...
  @titles     = @doc.css('li.philologic_occurrence').collect { |o| Philologic::Client::Occurrence.new(o, client) }
end

Instance Attribute Details

#titlesObject (readonly)

Get Array of Philologic::Client::Occurrence objects



40
41
42
# File 'lib/philologic-client/bibliography.rb', line 40

def titles
  @titles
end