Module: Bio::BlastXMLParser::MapXPath

Includes:
XPath
Included in:
NokogiriBlastHit, NokogiriBlastHsp, NokogiriBlastIterator
Defined in:
lib/bio/db/blast/parser/nokogiri.rb

Overview

Some magic to create XML -> method mappers, on the fly

Class Method Summary collapse

Instance Method Summary collapse

Methods included from XPath

#field

Class Method Details

.define_f(map) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/bio/db/blast/parser/nokogiri.rb', line 41

def MapXPath.define_f map
  map.each { |k,v| 
    define_method(v) {
      field(k).to_f
    }
  }
end

.define_i(map) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/bio/db/blast/parser/nokogiri.rb', line 34

def MapXPath.define_i map
  map.each { |k,v| 
    define_method(v) {
      field(k).to_i
    }
  }
end

.define_s(map) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/bio/db/blast/parser/nokogiri.rb', line 27

def MapXPath.define_s map
  map.each { |k,v| 
    define_method(v) {
      field(k)
    }
  }
end

Instance Method Details

#[](name) ⇒ Object



48
49
50
# File 'lib/bio/db/blast/parser/nokogiri.rb', line 48

def [] name
  field(name)
end