Class: Philologic::Client::Frequency
- Defined in:
- lib/philologic-client/frequency.rb
Overview
Philologic frequency table.
Extends Philologic::Client::Response
Instance Attribute Summary collapse
-
#label_header ⇒ Object
readonly
Get label header or
nil
. -
#results ⇒ Object
readonly
Get
Array
of Philologic::Client::FrequencyRow objects. -
#value_header ⇒ Object
readonly
Get value header or
nil
.
Attributes inherited from Response
Instance Method Summary collapse
-
#initialize(document, client = nil) ⇒ Frequency
constructor
Initialize Philologic::Client::Frequency object.
-
#results? ⇒ Boolean
Does this frequency table contain results?.
Methods inherited from Response
Constructor Details
#initialize(document, client = nil) ⇒ Frequency
Initialize Philologic::Client::Frequency object.
Params:
document
-
Nokogiri document
client
-
(optional) Philologic::Client object or
nil
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/philologic-client/frequency.rb', line 34 def initialize(document, client = nil) super header = @doc.css('table.philologic_table > tr.freq_header_row').first unless header.nil? @label_header = header.css('th.freq_label_header').first.text @value_header = header.css('th.freq_value_header').first.text end @results = @doc.css('tr.freq_row').collect { |tr| Philologic::Client::FrequencyRow.new(tr) } end |
Instance Attribute Details
#label_header ⇒ Object (readonly)
Get label header or nil
15 16 17 |
# File 'lib/philologic-client/frequency.rb', line 15 def label_header @label_header end |
#results ⇒ Object (readonly)
Get Array
of Philologic::Client::FrequencyRow objects
20 21 22 |
# File 'lib/philologic-client/frequency.rb', line 20 def results @results end |
#value_header ⇒ Object (readonly)
Get value header or nil
25 26 27 |
# File 'lib/philologic-client/frequency.rb', line 25 def value_header @value_header end |
Instance Method Details
#results? ⇒ Boolean
Does this frequency table contain results?
49 50 51 |
# File 'lib/philologic-client/frequency.rb', line 49 def results? @results.size > 0 ? true : false end |