Class: Philologic::Client::FrequencyRow
- Inherits:
-
Object
- Object
- Philologic::Client::FrequencyRow
- Defined in:
- lib/philologic-client/frequency_row.rb
Overview
Philologic frequency table row.
Usage
# <tr class='freq_row'>
# <td class='freq_label'>
# <a href='./?q=lion&title=A+Midsummer+Night%27s+Dream'>
# A Midsummer Night's Dream
# </a>
# </td>
# <td class='freq_value'>
# 30
# </td>
# </tr>
r = Philologic::Client::FrequencyRow.new(html)
r.label # "A Midsummer Night's Dream"
r.link # './?q=lion&title=A+Midsummer+Night%27s+Dream'
r.value # "0"
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Get label or
nil
. -
#link ⇒ Object
readonly
Get link or
nil
. -
#value ⇒ Object
readonly
Get value or
nil
.
Instance Method Summary collapse
-
#initialize(document) ⇒ FrequencyRow
constructor
Initialize Philologic::Client::FrequencyRow object.
Constructor Details
#initialize(document) ⇒ FrequencyRow
Initialize Philologic::Client::FrequencyRow object.
Params:
document
-
Nokogiri document
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/philologic-client/frequency_row.rb', line 49 def initialize(document) @label = @link = @value = nil unless document.css('td.freq_label').first.nil? @label = document.css('td.freq_label').first.text end unless document.css('a').first.nil? @link = document.css('a').first.attributes['href'].value end unless document.css('td.freq_value').first.nil? @value = document.css('td.freq_value').first.text end end |
Instance Attribute Details
#label ⇒ Object (readonly)
Get label or nil
31 32 33 |
# File 'lib/philologic-client/frequency_row.rb', line 31 def label @label end |
#link ⇒ Object (readonly)
Get link or nil
36 37 38 |
# File 'lib/philologic-client/frequency_row.rb', line 36 def link @link end |
#value ⇒ Object (readonly)
Get value or nil
41 42 43 |
# File 'lib/philologic-client/frequency_row.rb', line 41 def value @value end |