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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf1b6341574db5a6cee39b7973ab1b10455ecd01
4
- data.tar.gz: 5c2a38270f517ff5c13e1cd84b803100c1b9b3f3
3
+ metadata.gz: 017e23477330b9cf2841a422f3d2d60b71d4288c
4
+ data.tar.gz: 3698f8522b0687d180a01ee817e0da43d4cb5e8f
5
5
  SHA512:
6
- metadata.gz: a065da14a70f8d6ffb6ddc7074f35c9ccc5147af1bc7fa6591c9ba04e14f0623665490a76fb7a65417a3b95c329d646c34d916b5d8e783b4a36a033b9b0d3a1b
7
- data.tar.gz: 522b3e5444ef11fb978309fd802c866bfe499f39f603e702c349f7425e7e6b418a3896da82b47c31d5631dbf90bd21db384b2f799e86318a93d1ebbb6ba6bc8c
6
+ metadata.gz: 2d064e3292e12916fafcc8c307814b09f4cb38b0c4455471777ae8c1a5046166fa1a9962669393f1422cedb8bc327c863c7422e8f4e810b3418de1b7d07949f6
7
+ data.tar.gz: c5709d9484f8cb1de6d04eb02137712b576b9cf753228491297af1864331090deb3f0b9bcc34872a02153cfb5c4a382fbca65485c94dc4c858333e5feb509a2c
data/README.md CHANGED
@@ -1,55 +1,6 @@
1
1
  # ScaffoldParser
2
2
 
3
- Scaffolds XML file parser from XSD spec
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', base_element_template]
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 base_element_template
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
- text = WithAttributes.new(element.text)
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}.to_h if has? '#{node.to_name}'"
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(&:to_h) if has? '#{node.to_name}'"
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 to_h"
98
- f.putsi " hash = WithAttributes.new({})"
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|
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'scaffold_parser'
6
- spec.version = '0.4.0'
6
+ spec.version = '0.5.0'
7
7
  spec.authors = ['Premysl Donat']
8
8
  spec.email = ['pdonat@seznam.cz']
9
9
 
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.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-25 00:00:00.000000000 Z
11
+ date: 2018-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler