polyrex 0.8.29 → 0.8.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/polyrex.rb +26 -11
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9f780f2497eee0bb328cedbacf2d450467c5743
|
4
|
+
data.tar.gz: e6350fe9139dd22a8b835ee5b31562f8ab1b9e12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ac931a09ed9793168f8ea133ab8ca342d94f552f9bbb827c05b15303b216f655b7c4a9ec5d40829b1b066429a45ad4db5eaeb7d121d80921d2a2e635bf7b233
|
7
|
+
data.tar.gz: e5cecbf9dbe3b4b49965278a14cc6c5d71ffff68646d12927e265bea47fee37d5a562fbf335c08fb19b10031be5820166710c726c17562b793ec2f4c185f16c6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/polyrex.rb
CHANGED
@@ -107,12 +107,14 @@ class Polyrex
|
|
107
107
|
@format_masks
|
108
108
|
end
|
109
109
|
|
110
|
-
def parse(buffer='')
|
110
|
+
def parse(buffer='', options={})
|
111
111
|
buffer = yield if block_given?
|
112
|
-
string_parse buffer
|
112
|
+
string_parse buffer, options
|
113
113
|
self
|
114
114
|
end
|
115
115
|
|
116
|
+
alias import parse
|
117
|
+
|
116
118
|
def element(s)
|
117
119
|
@doc.root.element(s)
|
118
120
|
end
|
@@ -124,7 +126,7 @@ class Polyrex
|
|
124
126
|
end
|
125
127
|
|
126
128
|
def schema=(s)
|
127
|
-
open
|
129
|
+
open(s)
|
128
130
|
summary_h = Hash[*@doc.root.xpath("summary/*").map {|x| [x.name, x.text]}.flatten]
|
129
131
|
#@summary = OpenStruct.new summary_h
|
130
132
|
@summary = RecordX.new summary_h
|
@@ -206,21 +208,34 @@ class Polyrex
|
|
206
208
|
[fields, a]
|
207
209
|
end
|
208
210
|
|
209
|
-
def string_parse(buffer)
|
211
|
+
def string_parse(buffer, options={})
|
210
212
|
|
211
213
|
raw_header = buffer.slice!(/<\?polyrex[^>]+>/)
|
212
214
|
|
213
215
|
if raw_header then
|
214
216
|
header = raw_header[/<?polyrex (.*)?>/,1]
|
215
|
-
header.scan(/\w+\=["'][^"']+["']/).map
|
216
|
-
|
217
|
-
|
218
|
-
|
217
|
+
a = header.scan(/\w+\=["'][^"']+["']/).map do |x|
|
218
|
+
r = x.split(/=/)
|
219
|
+
[(r[0] + "=").to_sym, r[1][/^["'](.*)["']$/,1]]
|
220
|
+
end
|
221
|
+
|
222
|
+
if options[:schema] then
|
223
|
+
a.delete a.assoc(:schema)
|
224
|
+
self.method(:schema=).call(options[:schema])
|
225
|
+
end
|
226
|
+
|
227
|
+
a.each do |name, value|
|
228
|
+
unless options.keys.include? name[0..-2].to_sym then
|
229
|
+
self.method(name).call(value)
|
230
|
+
end
|
231
|
+
end
|
219
232
|
end
|
220
233
|
|
221
|
-
|
234
|
+
|
222
235
|
raw_lines = buffer.strip.split(/\r?\n|\r(?!\n)/)
|
223
236
|
|
237
|
+
raw_summary = schema[/^\w+\[([^\]]+)/,1]
|
238
|
+
|
224
239
|
if raw_summary then
|
225
240
|
a_summary = raw_summary.split(',').map(&:strip)
|
226
241
|
|
@@ -386,8 +401,8 @@ class Polyrex
|
|
386
401
|
|
387
402
|
@doc = Rexle.new buffer
|
388
403
|
|
389
|
-
schema = @doc.root.text('summary/schema')
|
390
|
-
|
404
|
+
schema = @schema ? @schema : @doc.root.text('summary/schema')
|
405
|
+
|
391
406
|
unless @format_masks
|
392
407
|
schema_rpath = schema.gsub(/\[[^\]]+\]/,'')
|
393
408
|
@recordx = schema_rpath.split('/')
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyrex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
7hfiCsNv+0o/OwBNlpn8pTTpd3jV6o1Qq0Y7QiFomKd6XWlaHT4ZNtZdb/XTpC7W
|
30
30
|
ZUZv+oXV5L4FrLlOrnTUhA+cZRntSyHs
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2013-09-
|
32
|
+
date: 2013-09-21 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: polyrex-schema
|
metadata.gz.sig
CHANGED
Binary file
|