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
57 58 59 60 61 |
# File 'lib/rubyMorphbank.rb', line 57 def record(xpath) self.root.elements.each(xpath + '/*'){}.inject([]) do |r,node| r << node.name.to_s << node.text.to_s.strip end.to_h end |
#records(xpath) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/rubyMorphbank.rb', line 63 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.to_h end end |