dxlite 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e0e8b4f265fe12323cca22407f3b06ce13f090192fb0abd83588aa4bd2cf13b
4
- data.tar.gz: e9b725095dde2698fbd7a6afed799fec375f0d4009901b2021bfad73371ad0cf
3
+ metadata.gz: e036712cdb12ebc28440edcfff5e89a9d7e3cd4bc92c5eeca4545b2158b3ad8d
4
+ data.tar.gz: '020807c1206d1388f60fc55facbe865fc2be92ee9ca9c4d8d4af8741073492cc'
5
5
  SHA512:
6
- metadata.gz: 439ffafee850ff7f07dd8915099c97cc24f4f9914780ce03231a57f200b43a734c3ebafeaa49d21f0b850a25bd5ce34b505e669bfac55bd911ea26c343313e6f
7
- data.tar.gz: 370a4daca23b52c6a0b2e06c9abcd653cb061e14d93dfd4195250f41cb8c6b220261388f9812ee977bfe09963c37f7a1d3ef3fc7f20b9dc110f2fccfcdbedd0d
6
+ metadata.gz: 33fabd7df1cbd07065b2627c4c6a56941b6ba68812b86ae3672fba34bc8f0ed06afc940af162217ed34385337f310b4154e5c900cea4d2cb7fbc8f12339be048
7
+ data.tar.gz: f16f8874284397716679de4b6f6a7e79e6145767b46d12fca47aca0895a1221ce592fd4e38bf0c8d5751fc81a3bf1a3fa4a978e50eb6b6c63e8e606de6b427d3
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -13,9 +13,9 @@ class DxLite
13
13
  attr_accessor :summary
14
14
  attr_reader :records
15
15
 
16
- def initialize(s, debug: false)
16
+ def initialize(s, filepath: nil, debug: false)
17
17
 
18
- @debug = debug
18
+ @filepath, @debug = filepath, debug
19
19
 
20
20
  buffer, type = RXFHelper.read(s)
21
21
  puts 'type: ' + type.inspect if @debug
@@ -39,8 +39,11 @@ class DxLite
39
39
 
40
40
  @schema = @summary[:schema]
41
41
 
42
- @summary.merge! @summary[:schema][/(?<=\[)[^\]]+/].split(',')\
43
- .map {|x|[x.strip, nil] }.to_h
42
+ summary = @summary[:schema][/(?<=\[)[^\]]+/]
43
+
44
+ if summary then
45
+ @summary.merge! summary.split(',').map {|x|[x.strip, nil] }.to_h
46
+ end
44
47
 
45
48
  # for each summary item create get and set methods
46
49
 
@@ -102,9 +105,11 @@ class DxLite
102
105
  alias import parse
103
106
 
104
107
  def save(file=@filepath)
105
- File.write file, @records.to_json
108
+ File.write file, {summary: @summary, records: @records}.to_json
106
109
  end
107
110
 
111
+ alias to_a records
112
+
108
113
  # Updates a record from an id and a hash containing field name and field value.
109
114
  # dynarex.update 4, name: Jeff, age: 38
110
115
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dxlite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file