dynarex 0.8.5 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/dynarex.rb +6 -0
- metadata +2 -2
data/lib/dynarex.rb
CHANGED
|
@@ -6,6 +6,7 @@ require 'rexml/document'
|
|
|
6
6
|
require 'nokogiri'
|
|
7
7
|
require 'open-uri'
|
|
8
8
|
require 'builder'
|
|
9
|
+
require 'ostruct'
|
|
9
10
|
|
|
10
11
|
class Dynarex
|
|
11
12
|
include REXML
|
|
@@ -186,6 +187,11 @@ EOF
|
|
|
186
187
|
load_records
|
|
187
188
|
self
|
|
188
189
|
end
|
|
190
|
+
|
|
191
|
+
def record(id)
|
|
192
|
+
h = Hash[*XPath.match(@doc.root, "records/*[@id='#{id}']/*").map {|x| [x.name, x.text]}.flatten]
|
|
193
|
+
OpenStruct.new h
|
|
194
|
+
end
|
|
189
195
|
|
|
190
196
|
private
|
|
191
197
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dynarex
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors: []
|
|
7
7
|
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2010-08-
|
|
12
|
+
date: 2010-08-29 00:00:00 +01:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|