Class: NCBIBlastResultsParser::RIDParser

Inherits:
Nokogiri::XML::SAX::Document
  • Object
show all
Defined in:
lib/ncbi_blast_results_parser/rid_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ridObject (readonly)

Returns the value of attribute rid.



4
5
6
# File 'lib/ncbi_blast_results_parser/rid_parser.rb', line 4

def rid
  @rid
end

#waitObject (readonly)

Returns the value of attribute wait.



4
5
6
# File 'lib/ncbi_blast_results_parser/rid_parser.rb', line 4

def wait
  @wait
end

Instance Method Details

#comment(string) ⇒ Object



6
7
8
9
# File 'lib/ncbi_blast_results_parser/rid_parser.rb', line 6

def comment(string)
  parse_rid(string) if string.strip.include? 'RID ='
  parse_wait_time(string) if string.strip.include? 'RTOE ='
end

#parse_rid(string) ⇒ Object



11
12
13
14
# File 'lib/ncbi_blast_results_parser/rid_parser.rb', line 11

def parse_rid(string)
  line = string[/((?:RID =.*?$){1})/]
  @rid = line.split.last
end

#parse_wait_time(string) ⇒ Object



16
17
18
19
# File 'lib/ncbi_blast_results_parser/rid_parser.rb', line 16

def parse_wait_time(string)
  line  = string[/((?:RTOE =.*?$){1})/]
  @wait = line.split.last.to_i
end