brocade_vrouter 0.4.6 → 0.4.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f98a6ac0013632ecc0787240521bbb2bb5b81957
4
- data.tar.gz: 4be8f4ebe4d80449a26de5eb81a2c60f9ad8fd71
3
+ metadata.gz: 82e2c6f4a465839111b3858ffc1d4d46d1c91410
4
+ data.tar.gz: 0ea9c6b48bfc779ad9239bce17602fdaa1e6e6a9
5
5
  SHA512:
6
- metadata.gz: cb0f1af345376c0ee32a248fea796ecb63e8e56115b291b238d7043e0ac25285bf16331b051eb8300fa5629f228d3443cfa5a8d80da05bdfffada91bef75f1fc
7
- data.tar.gz: 2d40bfef141a3fb82ec5ba1ad68d2af9ea08a3b8c9128342424d150d7e82bdc5460e0152592c70217caeead4508e123446dd313ebdda8a5601916f2c2ad63ddb
6
+ metadata.gz: c5bec02a57edb2dc30c9b110d292b2db92367a994f1be70caf9eebeb791265bcaa1a0763cb831f377cf2539da3b76f3d81a50eed2fd5152319fda4c6d7351edb
7
+ data.tar.gz: f96f80e618fa36c90940cb85ccb977e68c934b322ef036ee062c4164612a1968287328496b4ec2fed212b1333e19bce58f99927b86acb1a717c4940007a14ad3
@@ -2,6 +2,8 @@
2
2
 
3
3
  module BrocadeVRouter
4
4
  class Configuration
5
+ ParseError = Class.new(StandardError)
6
+
5
7
  LTSEP = ' '.freeze
6
8
  OBRKT = '{'.freeze
7
9
  CBRKT = '}'.freeze
@@ -23,26 +25,30 @@ module BrocadeVRouter
23
25
  def parse_lines!(lines, path)
24
26
  conf = {}
25
27
  while lines.any?
26
- literals = lines.shift.split(LTSEP)
27
- name = literals.shift
28
-
29
- if name == CBRKT
30
- return conf
31
- elsif literals.last == OBRKT
32
- if literals.first != OBRKT
33
- conf[name] ||= {}
34
- conf[name][literals.first] = parse_lines! lines, path + [name, literals.first]
35
- else
36
- conf[name] = parse_lines! lines, path + [name]
37
- end
38
- else
39
- value = literals.join(LTSEP).tr('\'"', '')
40
- if array_field?(path, name)
41
- conf[name] ||= []
42
- conf[name] << value
28
+ begin
29
+ literals = lines.shift.split(LTSEP)
30
+ name = literals.shift
31
+
32
+ if name == CBRKT
33
+ return conf
34
+ elsif literals.last == OBRKT
35
+ if literals.first != OBRKT
36
+ conf[name] ||= {}
37
+ conf[name][literals.first] = parse_lines! lines, path + [name, literals.first]
38
+ else
39
+ conf[name] = parse_lines! lines, path + [name]
40
+ end
43
41
  else
44
- conf[name] = value.empty? ? nil : value
42
+ value = literals.join(LTSEP).tr('\'"', '')
43
+ if array_field?(path, name)
44
+ conf[name] ||= []
45
+ conf[name] << value
46
+ else
47
+ conf[name] = value.empty? ? nil : value
48
+ end
45
49
  end
50
+ rescue StandardError => e
51
+ raise ParseError.new("#{e.message}: #{literals}")
46
52
  end
47
53
  end
48
54
 
@@ -1,3 +1,3 @@
1
1
  module BrocadeVRouter
2
- VERSION = '0.4.6'.freeze
2
+ VERSION = '0.4.7'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brocade_vrouter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Kosmatov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-08 00:00:00.000000000 Z
11
+ date: 2017-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday