recordx 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/lib/recordx.rb +47 -41
  4. data.tar.gz.sig +0 -0
  5. metadata +31 -31
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66b94a9581c40bd7c296524e7b48329421ec1b27ef0bfa4750e82285f8444409
4
- data.tar.gz: 66ab87256af6a15162e46c98b977d2f02052e3a34407ea71a6d518a57fb14cee
3
+ metadata.gz: 843e6a429e72573650377022053a10cf879c6f151d3a43966922f1154bc0af15
4
+ data.tar.gz: 00ba50d0bc239fc24269421f88eb8fbaae634893d0a735a36b8392f1a411f81e
5
5
  SHA512:
6
- metadata.gz: a9522ad352a0609da2409d6a8b82bb471d0481d05b2484e3973d0aa5979ef8e0715d5c1170be3043a1cf77e5788787ff230255501a87b071c4528b1b512b7591
7
- data.tar.gz: f8563ee06dc8268a699a98975086aa146c6745ebe03bf00ff378e76a3fd8fe2e1a50f173dd8e0e6d805d9519aeffba37d15a3ff781f98c186ae36e4dc1f7e048
6
+ metadata.gz: ed493de1e9c6ea457f2eb8f35812f30c89c31b36f8993b3affb73c69fe28b458c02d40e889619d7cb4db64dfda7d351a53230f69bbebdbd6ee4158c844f7113a
7
+ data.tar.gz: f4d45056871fd9ea42b0006d080ac85ea7820c0a8bb3b75f66f85bbf95a2f2f54ad389c995e2e92190b8ee9452911485534000148839e83179de0bb098b1aa39
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/recordx.rb CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
 
6
6
  require 'rexle'
7
+ require 'kvx'
8
+ require 'rxfreader'
7
9
  require 'rexle-builder'
8
10
 
9
11
 
@@ -11,56 +13,60 @@ class RecordX
11
13
  using ColouredText
12
14
 
13
15
  attr_reader :id, :created, :last_modified
14
-
16
+
15
17
  class RXHash < Hash
16
-
18
+
17
19
  def initialize(callerx)
18
20
  super()
19
- @callerx = callerx
21
+ @callerx = callerx
20
22
  end
21
23
 
22
24
  def []=(name, val)
23
25
  unless @callerx.send(name.to_sym) == val then
24
- @callerx.send((name.to_s + '=').to_sym, val)
26
+ @callerx.send((name.to_s + '=').to_sym, val)
25
27
  end
26
28
  super(name, val)
27
29
  end
28
-
30
+
29
31
  def clone()
30
32
  self.to_h.clone
31
33
  end
32
34
  end
33
35
 
34
- def initialize(x=nil, callerx=nil, id=nil, created=nil, last_modified=nil,
36
+ def initialize(x=nil, callerx=nil, id=nil, created=nil, last_modified=nil,
35
37
  debug: false)
36
-
38
+
37
39
  @debug = debug
38
40
  puts ('x: ' + x.inspect).debug if @debug
39
41
 
40
42
  h = if x.is_a? Hash then x
41
-
43
+
42
44
  x
43
-
45
+
44
46
  elsif x.is_a? Array then
45
-
47
+
46
48
  x.inject({}) do |r,y|
47
49
  val = y.text.is_a?(String) ? y.text.unescape : ''
48
50
  r.merge(y.name.to_sym => val)
49
51
  end
50
-
52
+
53
+ elsif x.respond_to? :to_h
54
+
55
+ x.to_h
56
+
51
57
  else
52
-
58
+
53
59
  x
54
-
60
+
55
61
  end
56
-
62
+
57
63
  @id, @created, @last_modified = id, created, last_modified
58
64
  @h = RXHash.new(self).merge h
59
65
  h.each {|name,val| attr_accessor2(name.to_s, val) }
60
66
  @callerx = callerx
61
-
67
+
62
68
  end
63
-
69
+
64
70
  def [](k) @h[k] end
65
71
  def []=(k,v) @h[k] = v end
66
72
  def keys() @h.keys end
@@ -83,39 +89,39 @@ class RecordX
83
89
  def to_h()
84
90
  @h.clone
85
91
  end
86
-
92
+
87
93
  def to_html(xslt: '')
88
94
 
89
95
  # This method is expected to be used within Dynarex
90
-
96
+
91
97
  kvx = self.to_kvx
92
98
 
93
- xsl_buffer = RXFHelper.read(xslt).first
99
+ xsl_buffer = RXFReader.read(xslt).first
94
100
  #jr100316 xslt = Nokogiri::XSLT(xsl_buffer)
95
- #jr100316 xslt.transform(Nokogiri::XML(kvx.to_xml)).to_s
101
+ #jr100316 xslt.transform(Nokogiri::XML(kvx.to_xml)).to_s
96
102
  Rexslt.new(xsl_buffer, kvx.to_xml).to_s
97
103
 
98
104
  end
99
-
105
+
100
106
  def to_kvx()
101
-
107
+
102
108
  puts 'inside to_kvx'.info if @debug
103
109
  kvx = Kvx.new(@h.to_h, debug: @debug)
104
-
110
+
105
111
  if @callerx and @callerx.summary[:recordx_type] then
106
112
  summary_fields = @callerx.summary.keys - [:recordx_type, \
107
113
  :format_mask, :schema, :default_key]
108
114
  summary_fields.each {|field| kvx.summary[field] = @callerx.summary[field] }
109
115
  end
110
-
116
+
111
117
  kvx
112
-
118
+
113
119
  end
114
-
120
+
115
121
  def to_s()
116
122
  self.to_kvx.to_s
117
123
  end
118
-
124
+
119
125
  def to_xml()
120
126
 
121
127
  def build(xml, h)
@@ -124,7 +130,7 @@ class RecordX
124
130
 
125
131
  xml = RexleBuilder.new
126
132
 
127
- Rexle.new(xml.root { build xml, h }).xml pretty: true
133
+ Rexle.new(xml.root { build xml, h }).xml pretty: true
128
134
  end
129
135
 
130
136
  def update(h)
@@ -134,16 +140,16 @@ class RecordX
134
140
  private
135
141
 
136
142
  def method_missing(method_name, *raw_args)
137
-
143
+
138
144
  arg = raw_args.length > 0 ? raw_args.first : nil
139
145
 
140
146
  attr_accessor2(method_name[/\w+/], arg)
141
- arg ? self.send(method_name, arg) : self.send(method_name)
147
+ arg ? self.send(method_name, arg) : self.send(method_name)
142
148
  end
143
149
 
144
150
  def attr_accessor2(name,val=nil)
145
151
 
146
- reserved_keywords = (
152
+ reserved_keywords = (
147
153
  Object.public_methods | \
148
154
  Kernel.public_methods | \
149
155
  public_methods + [:method_missing]
@@ -153,13 +159,13 @@ class RecordX
153
159
  if (reserved_keywords - exceptions - @h.keys).include? name.to_sym then
154
160
  raise "recordx: reserved keyword *#{name}* can't be used as a field name"
155
161
  end
156
-
162
+
157
163
  self.instance_eval %Q{
158
-
164
+
159
165
  def #{name}=(s)
160
-
166
+
161
167
  puts 'inside #{name} assignment' if @debug
162
-
168
+
163
169
  @#{name} = s.to_s
164
170
  unless @h[:#{name}] == s.to_s then
165
171
  @h[:#{name}] = s.to_s
@@ -168,19 +174,19 @@ class RecordX
168
174
  end
169
175
 
170
176
  }
171
-
177
+
172
178
  # If this method has been monkey patched don't attempt to overwrite it
173
-
179
+
174
180
  if not self.public_methods.include? name.to_sym then
175
- self.instance_eval %Q{
181
+ self.instance_eval %Q{
176
182
  def #{name}()
177
183
  @#{name}
178
184
  end
179
185
  }
180
186
  end
181
-
187
+
182
188
  self.method((name + '=').to_sym).call val if val
183
-
189
+
184
190
  end
185
191
 
186
- end
192
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recordx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -11,54 +11,54 @@ cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
- YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjAwNjIxMTY0MTExWhcN
15
- MjEwNjIxMTY0MTExWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
- cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC8oROj
17
- q1T8dkqSmgVhtBw9agpgrnsmDmAxwxT+7zHckhCPmfYrKOaRdkKNitNsHMoTfykr
18
- t6pHzLGzfecoX7kpyRm0h4q/4wPMaKQaAytrRkC9qleQJttN7L8gx47/aqw2btRS
19
- bRh2iNgaxl2x9gpZ/twgSSy5suTZuoVyrwBQQ5E0//XTzxk7v8Ey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d4xIcAPpIzFj9QRYjkSUCEuRHlEl7X
30
+ jepBTwG7gvFPG017dN0tJ+KMeIYIMPkGpVS2HpdVivGP6Mi0FmVAfQQNCK9vGbKZ
31
+ Q2/nOEl9fVJN/T6RyGj2FastDNR19eInbKh0BEFrlT1P1JvixFN2yvEZE1WCc/j6
32
+ Lee70CFxZ2nbo38W+Ib9/xsH63ReblZdyZQ+rZeylCfUYW7My6nmFocOORx6FlaC
33
+ ui0KGYozMGHnUcUg1ugJXYgQbcZNuogYbOtfNUO4JraXvWNufVaSSC2Drs9N0hoo
34
+ 6v5qwwlJDbWqIY77HByBTuAKnL3ieOFagNPAMpc2jqCeb87djPW4yaqf3VPiErCI
35
+ c2Br1Vud354zuw/XUJjWaUJE9aaj0epjLLrkLPQbv5pyjFmIepSjv2rEX/kZ2lqb
36
+ Puc+e2w9l3V2/PUSgRgVdvWq
37
37
  -----END CERTIFICATE-----
38
- date: 2020-06-21 00:00:00.000000000 Z
38
+ date: 2022-02-22 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
- name: rexle
41
+ name: kvx
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '1.5'
46
+ version: '1.1'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 1.5.6
49
+ version: 1.1.0
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '1.5'
56
+ version: '1.1'
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 1.5.6
59
+ version: 1.1.0
60
60
  description:
61
- email: james@jamesrobertson.eu
61
+ email: digital.robertson@gmail.com
62
62
  executables: []
63
63
  extensions: []
64
64
  extra_rdoc_files: []
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
86
- rubygems_version: 3.0.3
86
+ rubygems_version: 3.2.22
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: A kind of Hash which can also use accessor methods to store or retrieve values.
metadata.gz.sig CHANGED
Binary file