junoser 0.3.10 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,9 +11,9 @@ module Junoser
11
11
  @config ||= children.map {|child|
12
12
  case child.name
13
13
  when 'choice'
14
- Junoser::Xsd::Choice.new(child, depth: @depth+1)
14
+ Junoser::Xsd::Choice.new(child, depth: @depth+1, parent: self)
15
15
  when 'element'
16
- Junoser::Xsd::Element.new(child, depth: @depth+1)
16
+ Junoser::Xsd::Element.new(child, depth: @depth+1, parent: self)
17
17
  when 'any'
18
18
  'any'
19
19
  else
@@ -28,7 +28,15 @@ module Junoser
28
28
  when has_single_child_of?(Junoser::Xsd::Choice)
29
29
  child = config.first
30
30
  str = child.config.map(&:to_s).reject(&:empty?).join(",\n")
31
- format('c(', str, ')') unless str.empty?
31
+
32
+ return if str.empty?
33
+
34
+ # Assuming that <xsd:sequence> always has <xsd:complexType> as the parent
35
+ if parent.parent&.oneliner? && config.first.unbounded?
36
+ format('sc(', str, ')')
37
+ else
38
+ format('c(', str, ')')
39
+ end
32
40
  else
33
41
  str = config.map {|c| c.is_a?(String) ? format(OFFSET + c) : c.to_s }.reject(&:empty?).join(",\n")
34
42
  format('s(', str, ')')
@@ -10,7 +10,7 @@ module Junoser
10
10
  @config ||= children.map {|child|
11
11
  case child.name
12
12
  when 'restriction'
13
- Junoser::Xsd::Restriction.new(child, depth: @depth+1)
13
+ Junoser::Xsd::Restriction.new(child, depth: @depth+1, parent: self)
14
14
  when 'extension'
15
15
  'arg'
16
16
  else
@@ -11,9 +11,9 @@ module Junoser
11
11
  @config ||= children.map {|child|
12
12
  case child.name
13
13
  when 'restriction'
14
- Junoser::Xsd::Restriction.new(child, depth: @depth+1)
14
+ Junoser::Xsd::Restriction.new(child, depth: @depth+1, parent: self)
15
15
  when 'union'
16
- Junoser::Xsd::Union.new(child, depth: @depth+1)
16
+ Junoser::Xsd::Union.new(child, depth: @depth+1, parent: self)
17
17
  else
18
18
  raise "ERROR: unknown element: #{child.name}"
19
19
  end
@@ -9,7 +9,7 @@ module Junoser
9
9
  @config ||= children.map {|child|
10
10
  case child.name
11
11
  when 'simpleType'
12
- Junoser::Xsd::SimpleType.new(child, depth: @depth+1)
12
+ Junoser::Xsd::SimpleType.new(child, depth: @depth+1, parent: self)
13
13
  else
14
14
  raise "ERROR: unknown element: #{child.name}"
15
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: junoser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shintaro Kojima
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-27 00:00:00.000000000 Z
11
+ date: 2021-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parslet
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -99,6 +99,9 @@ files:
99
99
  - Rakefile
100
100
  - bin/console
101
101
  - bin/setup
102
+ - example/get-schema.xml
103
+ - example/junos-18.1R3-S9.rb
104
+ - example/mx-19.3R3-S1.3.rb
102
105
  - example/vmx-17.2R1.13.rb
103
106
  - example/vsrx-12.1.x47.rb
104
107
  - example/vsrx-18.3R1.9.rb
@@ -135,7 +138,7 @@ files:
135
138
  homepage: https://github.com/codeout/junoser
136
139
  licenses: []
137
140
  metadata: {}
138
- post_install_message:
141
+ post_install_message:
139
142
  rdoc_options: []
140
143
  require_paths:
141
144
  - lib
@@ -150,8 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
153
  - !ruby/object:Gem::Version
151
154
  version: '0'
152
155
  requirements: []
153
- rubygems_version: 3.1.2
154
- signing_key:
156
+ rubygems_version: 3.2.15
157
+ signing_key:
155
158
  specification_version: 4
156
159
  summary: PEG parser for JUNOS configuration.
157
160
  test_files: []