Class: Philologic::Client::Concordance

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

Overview

Philologic concordance search results.

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) ⇒ Concordance

Initialize Philologic::Client::Concordance object.

Params:

document

Nokogiri document

client

(optional) Philologic::Client object or nil



22
23
24
25
26
# File 'lib/philologic-client/concordance.rb', line 22

def initialize(document, client = nil)
  super

  @results = @doc.css('li.philologic_occurrence').collect { |o| Philologic::Client::Occurrence.new(o, client) }
end

Instance Attribute Details

#resultsObject (readonly)

Get Array of Philologic::Client::Occurrence objects



13
14
15
# File 'lib/philologic-client/concordance.rb', line 13

def results
  @results
end

Instance Method Details

#results?Boolean

Were any results found?

Returns:

  • (Boolean)


31
32
33
# File 'lib/philologic-client/concordance.rb', line 31

def results?
  @results.size > 0 ? true : false
end