recordx 0.5.3 → 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 +53 -46
  4. data.tar.gz.sig +0 -0
  5. metadata +31 -32
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 918fa7b4af8c1c9290f4ec35b90ebe918a579f40d34c335deb5ff36a5146308c
4
- data.tar.gz: f245347dde3b832eb8c0813e3cd428ec1c4617c7a09fb8319792c72bbc01da2b
3
+ metadata.gz: 843e6a429e72573650377022053a10cf879c6f151d3a43966922f1154bc0af15
4
+ data.tar.gz: 00ba50d0bc239fc24269421f88eb8fbaae634893d0a735a36b8392f1a411f81e
5
5
  SHA512:
6
- metadata.gz: c823724e96d1221f93a3ec8cb5848868685730cdc52ed53d0ac5597958cc0e9cc5ea8e8fce722264a60d026467098a3a6c4870fc7da46f56566183bf84929756
7
- data.tar.gz: f1bc3e5d9eaf39ba67a3de185a82e7806cfe17f46720aaa31b3a6a588d5be71dc053f8c48a57d77fb5ea6e9a20988fa6683cec1a61e5298814a58828de75933f
6
+ metadata.gz: ed493de1e9c6ea457f2eb8f35812f30c89c31b36f8993b3affb73c69fe28b458c02d40e889619d7cb4db64dfda7d351a53230f69bbebdbd6ee4158c844f7113a
7
+ data.tar.gz: f4d45056871fd9ea42b0006d080ac85ea7820c0a8bb3b75f66f85bbf95a2f2f54ad389c995e2e92190b8ee9452911485534000148839e83179de0bb098b1aa39
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/recordx.rb CHANGED
@@ -4,62 +4,69 @@
4
4
 
5
5
 
6
6
  require 'rexle'
7
+ require 'kvx'
8
+ require 'rxfreader'
7
9
  require 'rexle-builder'
8
10
 
9
11
 
10
12
  class RecordX
13
+ using ColouredText
11
14
 
12
15
  attr_reader :id, :created, :last_modified
13
-
16
+
14
17
  class RXHash < Hash
15
-
18
+
16
19
  def initialize(callerx)
17
20
  super()
18
- @callerx = callerx
21
+ @callerx = callerx
19
22
  end
20
23
 
21
24
  def []=(name, val)
22
25
  unless @callerx.send(name.to_sym) == val then
23
- @callerx.send((name.to_s + '=').to_sym, val)
26
+ @callerx.send((name.to_s + '=').to_sym, val)
24
27
  end
25
28
  super(name, val)
26
29
  end
27
-
30
+
28
31
  def clone()
29
32
  self.to_h.clone
30
33
  end
31
34
  end
32
35
 
33
- 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,
34
37
  debug: false)
35
-
38
+
36
39
  @debug = debug
37
- puts 'x: ' + x.inspect if @debug
40
+ puts ('x: ' + x.inspect).debug if @debug
38
41
 
39
42
  h = if x.is_a? Hash then x
40
-
43
+
41
44
  x
42
-
45
+
43
46
  elsif x.is_a? Array then
44
-
47
+
45
48
  x.inject({}) do |r,y|
46
49
  val = y.text.is_a?(String) ? y.text.unescape : ''
47
50
  r.merge(y.name.to_sym => val)
48
51
  end
49
-
52
+
53
+ elsif x.respond_to? :to_h
54
+
55
+ x.to_h
56
+
50
57
  else
51
-
58
+
52
59
  x
53
-
60
+
54
61
  end
55
-
56
- @callerx, @id, @created, @last_modified = callerx, id, \
57
- created, last_modified
62
+
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
67
+
61
68
  end
62
-
69
+
63
70
  def [](k) @h[k] end
64
71
  def []=(k,v) @h[k] = v end
65
72
  def keys() @h.keys end
@@ -82,39 +89,39 @@ class RecordX
82
89
  def to_h()
83
90
  @h.clone
84
91
  end
85
-
92
+
86
93
  def to_html(xslt: '')
87
94
 
88
95
  # This method is expected to be used within Dynarex
89
-
96
+
90
97
  kvx = self.to_kvx
91
98
 
92
- xsl_buffer = RXFHelper.read(xslt).first
99
+ xsl_buffer = RXFReader.read(xslt).first
93
100
  #jr100316 xslt = Nokogiri::XSLT(xsl_buffer)
94
- #jr100316 xslt.transform(Nokogiri::XML(kvx.to_xml)).to_s
101
+ #jr100316 xslt.transform(Nokogiri::XML(kvx.to_xml)).to_s
95
102
  Rexslt.new(xsl_buffer, kvx.to_xml).to_s
96
103
 
97
104
  end
98
-
105
+
99
106
  def to_kvx()
100
-
101
- puts 'inside to_kvx' if @debug
102
- kvx = Kvx.new(@h.to_h)
103
-
107
+
108
+ puts 'inside to_kvx'.info if @debug
109
+ kvx = Kvx.new(@h.to_h, debug: @debug)
110
+
104
111
  if @callerx and @callerx.summary[:recordx_type] then
105
112
  summary_fields = @callerx.summary.keys - [:recordx_type, \
106
113
  :format_mask, :schema, :default_key]
107
114
  summary_fields.each {|field| kvx.summary[field] = @callerx.summary[field] }
108
115
  end
109
-
116
+
110
117
  kvx
111
-
118
+
112
119
  end
113
-
120
+
114
121
  def to_s()
115
122
  self.to_kvx.to_s
116
123
  end
117
-
124
+
118
125
  def to_xml()
119
126
 
120
127
  def build(xml, h)
@@ -123,7 +130,7 @@ class RecordX
123
130
 
124
131
  xml = RexleBuilder.new
125
132
 
126
- Rexle.new(xml.root { build xml, h }).xml pretty: true
133
+ Rexle.new(xml.root { build xml, h }).xml pretty: true
127
134
  end
128
135
 
129
136
  def update(h)
@@ -133,16 +140,16 @@ class RecordX
133
140
  private
134
141
 
135
142
  def method_missing(method_name, *raw_args)
136
-
143
+
137
144
  arg = raw_args.length > 0 ? raw_args.first : nil
138
145
 
139
146
  attr_accessor2(method_name[/\w+/], arg)
140
- arg ? self.send(method_name, arg) : self.send(method_name)
147
+ arg ? self.send(method_name, arg) : self.send(method_name)
141
148
  end
142
149
 
143
150
  def attr_accessor2(name,val=nil)
144
151
 
145
- reserved_keywords = (
152
+ reserved_keywords = (
146
153
  Object.public_methods | \
147
154
  Kernel.public_methods | \
148
155
  public_methods + [:method_missing]
@@ -152,13 +159,13 @@ class RecordX
152
159
  if (reserved_keywords - exceptions - @h.keys).include? name.to_sym then
153
160
  raise "recordx: reserved keyword *#{name}* can't be used as a field name"
154
161
  end
155
-
162
+
156
163
  self.instance_eval %Q{
157
-
164
+
158
165
  def #{name}=(s)
159
-
166
+
160
167
  puts 'inside #{name} assignment' if @debug
161
-
168
+
162
169
  @#{name} = s.to_s
163
170
  unless @h[:#{name}] == s.to_s then
164
171
  @h[:#{name}] = s.to_s
@@ -167,19 +174,19 @@ class RecordX
167
174
  end
168
175
 
169
176
  }
170
-
177
+
171
178
  # If this method has been monkey patched don't attempt to overwrite it
172
-
179
+
173
180
  if not self.public_methods.include? name.to_sym then
174
- self.instance_eval %Q{
181
+ self.instance_eval %Q{
175
182
  def #{name}()
176
183
  @#{name}
177
184
  end
178
185
  }
179
186
  end
180
-
187
+
181
188
  self.method((name + '=').to_sym).call val if val
182
-
189
+
183
190
  end
184
191
 
185
- 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.3
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
- YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwOTI2MjExNzA1WhcN
15
- MTkwOTI2MjExNzA1WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
- cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCqe0ns
17
- PJhx/E+DCKiGs466cNHUoGbPa2cSwmezDzZykhh0oyPt1fUaX2WjxG6bwibjrSbc
18
- 7GbvVR1OT4y02Q1KTBQuDI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qhkiG9w0BAQsFAAOCAYEACarv5CWButZ0p3od37VRkXaRl5DbTIJKvoS2mr2v
29
+ jiW+TQYVXxnPm98kUyiWaEQ6WKoSMj6vWwd4xIcAPpIzFj9QRYjkSUCEuRHlEl7X
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: 2018-10-02 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.3'
46
+ version: '1.1'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 1.3.36
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.3'
56
+ version: '1.1'
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 1.3.36
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,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
86
- rubyforge_project:
87
- rubygems_version: 2.7.6
86
+ rubygems_version: 3.2.22
88
87
  signing_key:
89
88
  specification_version: 4
90
89
  summary: A kind of Hash which can also use accessor methods to store or retrieve values.
metadata.gz.sig CHANGED
Binary file