Class: REXML::Document
- Inherits:
-
Object
- Object
- REXML::Document
- Defined in:
- lib/rubyMorphbank.rb
Overview
neither of these extensions is particularly good, they don’t recurse etc.
Instance Method Summary collapse
Instance Method Details
#record(xpath) ⇒ Object
50 51 52 53 54 |
# File 'lib/rubyMorphbank.rb', line 50 def record(xpath) self.root.elements.each(xpath + '/*'){}.inject([]) do |r,node| r << node.name.to_s << node.text.to_s.strip end.make_a_hash end |
#records(xpath) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/rubyMorphbank.rb', line 56 def records(xpath) self.root.elements.each(xpath){}.map do |row| row.elements.each{}.inject([]) do |r,node| r << node.name.to_s << node.text.to_s.strip end.make_a_hash end end |