Class: Philologic::Client::Collocation::Row

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

Overview

Row within a collocation table.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document = nil) ⇒ Row

Returns a new instance of Row.



68
69
70
71
72
73
74
75
76
77
78
# File 'lib/philologic-client/collocation.rb', line 68

def initialize(document = nil)
  both = document.css('td.colloc_both_value').first
  @word  = both.css('span.colloc_label').text
  @value = both.css('span.colloc_value').text.to_i
  left = document.css('td.colloc_left_value').first
  @left_word  = left.css('a.colloc_label').text
  @left_value = left.css('span.colloc_value').text.to_i
  right= document.css('td.colloc_right_value').first
  @right_word  = right.css('a.colloc_label').text
  @right_value = right.css('span.colloc_value').text.to_i
end

Instance Attribute Details

#left_valueObject (readonly)

Get value or 0



54
55
56
# File 'lib/philologic-client/collocation.rb', line 54

def left_value
  @left_value
end

#left_wordObject (readonly)

Get left word or nil



58
59
60
# File 'lib/philologic-client/collocation.rb', line 58

def left_word
  @left_word
end

#right_valueObject (readonly)

Get value or 0



62
63
64
# File 'lib/philologic-client/collocation.rb', line 62

def right_value
  @right_value
end

#right_wordObject (readonly)

Get right word or nil



66
67
68
# File 'lib/philologic-client/collocation.rb', line 66

def right_word
  @right_word
end

#valueObject (readonly)

Get value or 0



46
47
48
# File 'lib/philologic-client/collocation.rb', line 46

def value
  @value
end

#wordObject (readonly)

Get word or nil



50
51
52
# File 'lib/philologic-client/collocation.rb', line 50

def word
  @word
end