scaffold_parser 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -50
- data/lib/scaffold_parser/scaffolders/xsd.rb +3 -5
- data/lib/scaffold_parser/scaffolders/xsd/parser.rb +4 -5
- data/scaffold_parser.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 017e23477330b9cf2841a422f3d2d60b71d4288c
|
4
|
+
data.tar.gz: 3698f8522b0687d180a01ee817e0da43d4cb5e8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d064e3292e12916fafcc8c307814b09f4cb38b0c4455471777ae8c1a5046166fa1a9962669393f1422cedb8bc327c863c7422e8f4e810b3418de1b7d07949f6
|
7
|
+
data.tar.gz: c5709d9484f8cb1de6d04eb02137712b576b9cf753228491297af1864331090deb3f0b9bcc34872a02153cfb5c4a382fbca65485c94dc4c858333e5feb509a2c
|
data/README.md
CHANGED
@@ -1,55 +1,6 @@
|
|
1
1
|
# ScaffoldParser
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Content:
|
6
|
-
1. [About](#about)
|
7
|
-
1. [Naming](#naming)
|
8
|
-
2. [What's missing](#whats-missing)
|
9
|
-
2. [Api](#api)
|
10
|
-
1. [Parsers](#parsers)
|
11
|
-
2. [Builder](#builder)
|
12
|
-
3. [Performance](#performance)
|
13
|
-
4. [External links](#external-links)
|
14
|
-
5. [License](#license)
|
15
|
-
|
16
|
-
## About
|
17
|
-
|
18
|
-
WIP
|
19
|
-
|
20
|
-
### Naming
|
21
|
-
|
22
|
-
WIP
|
23
|
-
|
24
|
-
#### Method names
|
25
|
-
|
26
|
-
WIP
|
27
|
-
|
28
|
-
#### Class names
|
29
|
-
|
30
|
-
WIP
|
31
|
-
|
32
|
-
### Missing parts
|
33
|
-
|
34
|
-
WIP
|
35
|
-
|
36
|
-
## Api
|
37
|
-
|
38
|
-
### Parsing a document
|
39
|
-
|
40
|
-
WIP
|
41
|
-
|
42
|
-
### Creating a document
|
43
|
-
|
44
|
-
WIP
|
45
|
-
|
46
|
-
## Performance
|
47
|
-
|
48
|
-
WIP
|
49
|
-
|
50
|
-
## External links
|
51
|
-
|
52
|
-
WIP
|
3
|
+
Unstable until 1.0.0
|
53
4
|
|
54
5
|
## License
|
55
6
|
|
@@ -24,7 +24,7 @@ module ScaffoldParser
|
|
24
24
|
[Parser.call(element.definition, @options), Builder.call(element.definition, @options)]
|
25
25
|
end
|
26
26
|
|
27
|
-
code.push ['parsers/base_parser.rb',
|
27
|
+
code.push ['parsers/base_parser.rb', base_parser_template]
|
28
28
|
code.push ['builders/base_builder.rb', base_builder_template]
|
29
29
|
end
|
30
30
|
|
@@ -48,7 +48,7 @@ module ScaffoldParser
|
|
48
48
|
collected
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
51
|
+
def base_parser_template
|
52
52
|
<<~TEMPLATE
|
53
53
|
module Parsers
|
54
54
|
module BaseParser
|
@@ -72,9 +72,7 @@ module ScaffoldParser
|
|
72
72
|
element = raw.locate(locator.to_s).first
|
73
73
|
|
74
74
|
if element
|
75
|
-
|
76
|
-
text.attributes = element.attributes
|
77
|
-
text
|
75
|
+
StringWithAttributes.new(element.text, element.attributes)
|
78
76
|
end
|
79
77
|
end
|
80
78
|
|
@@ -83,10 +83,10 @@ module ScaffoldParser
|
|
83
83
|
end
|
84
84
|
|
85
85
|
node.submodel_nodes.each do |node|
|
86
|
-
lines << "hash[:#{node.to_name.underscore}] = #{node.to_name.underscore}.
|
86
|
+
lines << "hash[:#{node.to_name.underscore}] = #{node.to_name.underscore}.to_h_with_attrs if has? '#{node.to_name}'"
|
87
87
|
end
|
88
88
|
node.array_nodes.reject { |l| l.list_element.xs_type? }.each do |node|
|
89
|
-
lines << "hash[:#{node.to_name.underscore}] = #{node.to_name.underscore}.map(&:
|
89
|
+
lines << "hash[:#{node.to_name.underscore}] = #{node.to_name.underscore}.map(&:to_h_with_attrs) if has? '#{node.to_name}'"
|
90
90
|
end
|
91
91
|
node.array_nodes.select { |l| l.list_element.xs_type? }.each do |node|
|
92
92
|
lines << "hash[:#{node.to_name.underscore}] = #{node.to_name.underscore} if has? '#{node.to_name}'"
|
@@ -94,9 +94,8 @@ module ScaffoldParser
|
|
94
94
|
if lines.any?
|
95
95
|
f.puts
|
96
96
|
|
97
|
-
f.putsi " def
|
98
|
-
f.putsi " hash =
|
99
|
-
f.putsi " hash.attributes = attributes"
|
97
|
+
f.putsi " def to_h_with_attrs"
|
98
|
+
f.putsi " hash = HashWithAttributes.new({}, attributes)"
|
100
99
|
f.puts
|
101
100
|
|
102
101
|
lines.each do |line|
|
data/scaffold_parser.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scaffold_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Premysl Donat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|