Class: BisearchEnzimHu::L2ResultPage

Inherits:
Object
  • Object
show all
Defined in:
lib/bisearch_enzim_hu/l2_result_page.rb

Constant Summary collapse

HEAD =
:head
SENSE =
:sense
ANTISENSE =
:antisense

Instance Method Summary collapse

Constructor Details

#initialize(f) ⇒ L2ResultPage

Returns a new instance of L2ResultPage.



15
16
17
18
19
# File 'lib/bisearch_enzim_hu/l2_result_page.rb', line 15

def initialize(f)
  @doc = Nokogiri::HTML(f)
  @direction = HEAD
  @hash = nil
end

Instance Method Details

#parseObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/bisearch_enzim_hu/l2_result_page.rb', line 21

def parse
  @hash = {}
  @doc.css("div.main").children.each_with_index do |el, i|

    d = detect_direction(el)
    if !d.nil?
      @direction = d
      @hash[@direction]           ||={}
      @hash[@direction][:results] ||=[]
      @hash[@direction][:matches]   ={}
    end

    detect_result(el)
    detect_matches(el, i)
  end
  @hash
end