kvx 0.7.2 → 0.7.3

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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/kvx.rb +11 -7
  5. metadata +2 -2
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f572275e01e83e1946e4f50a76c5f22d72681827bea7663fe953d305a93183f
4
- data.tar.gz: 46ac5784d8415a7624cc3d1bfec9b2b10ddc00c58d5f9162a906faf0d0bd91a3
3
+ metadata.gz: 6cd1be9cd3370796707ca6191b5a501c15f4018b6bf63897ece6f8d057106608
4
+ data.tar.gz: 99c9f55cc660bf7708c2988548aa9dcbcc1c7dbb095b96e0dcdacdf54f91e9d9
5
5
  SHA512:
6
- metadata.gz: d2e1c5b2380ae0ba9230fe2ab605d500f85c7a222effd02581e6d6fca93d57ea876b612f0963810c45e83ff78cbe38d1b4055fb53ffd65ae0a6488f2c85c02aa
7
- data.tar.gz: 9941e95f40d7f2b5303a4dd32a2164110d9150af29ad8ba35257a0cc49c4719007ed2bc8cf5a12885ee39ed22dcaf5562809cb496d370b3003b4a4a49caa0a26
6
+ metadata.gz: c9955b9d32879f63809fb214ea8d125f67bc40005ef48508365466fc8d86bd7e2f2dfc11db909c11a9d176c8b8d3c5bba502a0576438b5beebdedf094a680181
7
+ data.tar.gz: ffd67e264ed849c10d371f77cd4679e2fcd8acee8eb39b761c5c61d50914430a90de8dedf179b60ba3e90939f8025b952e5d9873fa80233e5b970c435c3a84ab
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/kvx.rb CHANGED
@@ -15,6 +15,7 @@ require 'rexle-builder'
15
15
 
16
16
  class Kvx
17
17
  include RXFHelperModule
18
+ using ColouredText
18
19
 
19
20
  attr_accessor :attributes, :summary
20
21
  attr_reader :to_h
@@ -37,6 +38,9 @@ class Kvx
37
38
  }
38
39
 
39
40
  @body = method(h[x.class.to_s.downcase.to_sym]).call x
41
+ @body.each do |k,v|
42
+ define_singleton_method(k){v} unless self.methods.include? k
43
+ end
40
44
 
41
45
  end
42
46
 
@@ -44,7 +48,7 @@ class Kvx
44
48
  @body
45
49
  end
46
50
 
47
- alias body item
51
+ alias body item
48
52
 
49
53
  def save(filename)
50
54
  FileX.write filename, self.to_s
@@ -91,7 +95,7 @@ class Kvx
91
95
 
92
96
  header = ''
93
97
 
94
- if @header or @summary.any? then
98
+ if @header or (@summary and @summary.any?) then
95
99
 
96
100
  attr = @attributes ? ' ' + @attributes\
97
101
  .map {|x| "%s='%s'" % x }.join(' ') : ''
@@ -168,7 +172,7 @@ class Kvx
168
172
  def parse_string(s)
169
173
 
170
174
  buffer, type = RXFHelper.read(s)
171
- puts 'buffer: ' + buffer.inspect if @debug
175
+ puts ('buffer: ' + buffer.inspect).debug if @debug
172
176
  buffer.lstrip =~ /^<\?xml/ ? xml_to_h(Rexle.new(buffer).root) : parse_to_h(buffer)
173
177
 
174
178
  end
@@ -226,10 +230,10 @@ class Kvx
226
230
 
227
231
  def scan_to_h(txt)
228
232
 
229
- puts 'inside scan_to_h' if @debug
233
+ puts ('inside scan_to_h').info if @debug
230
234
  raw_a = LineTree.new(txt.gsub(/(^-*$)|(#.*)/,'').strip,
231
235
  ignore_blank_lines: @ignore_blank_lines).to_a
232
- puts 'raw_a: ' + raw_a.inspect if @debug
236
+ puts ('raw_a: ' + raw_a.inspect).debug if @debug
233
237
 
234
238
  # if there are any orphan lines which aren't nested underneath a
235
239
  # label, they will be fixed using the following statement
@@ -246,7 +250,7 @@ class Kvx
246
250
  @body = a.inject({}) do |r, line|
247
251
 
248
252
  s = line.shift
249
- puts 's: ' + s.inspect
253
+ puts ('s: ' + s.inspect).debug if @debug
250
254
 
251
255
  if line.join.length > 0 then
252
256
 
@@ -289,7 +293,7 @@ class Kvx
289
293
 
290
294
  end
291
295
 
292
- puts '@body: ' + @body.inspect
296
+ puts ('@body: ' + @body.inspect).debug if @debug
293
297
  @body
294
298
 
295
299
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kvx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -30,7 +30,7 @@ cert_chain:
30
30
  3jLvreiNd0YuFPcPe+esHvUwxhE00qsh/ZWy9pwic9ywLOFdKbCguhaIs0sbQ2d2
31
31
  YoI=
32
32
  -----END CERTIFICATE-----
33
- date: 2018-08-12 00:00:00.000000000 Z
33
+ date: 2018-12-23 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: line-tree
metadata.gz.sig CHANGED
Binary file