wp-uppercrust 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uppercrust/parser.rb +10 -12
- data/lib/uppercrust/version.rb +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: 78102c85e5215554c1ad6fe09584fb2c2900d577
|
4
|
+
data.tar.gz: ba7b2fc9887a3ed42640d6f7109011f051aae6d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33142374fd80687db5dcfb0c08dfb6d9711c74cf02ebeba373d4eb37fdeb3f6b861cebf13a29f5e700e45665c683e5e4ddb13c5df72bb90c5ba3e91f4c533b16
|
7
|
+
data.tar.gz: fc46e34c360f50fb1fbb25f9954075dd6f0611646eec417e7b8a0c6775d4dd8ee9145cbeb51788e951e81e263b75307d14ab8d37bd89e15fc1190495a27f07dc
|
data/lib/uppercrust/parser.rb
CHANGED
@@ -57,11 +57,11 @@ class Parser
|
|
57
57
|
|
58
58
|
properties.each do |name, type_info|
|
59
59
|
if self.match_type(type_info['type']) == 'NSArray' && type_info['items']['$ref'] != nil && type_info['items']['$ref'] != '#'
|
60
|
-
contains << "#import \"
|
60
|
+
contains << "#import \"#{self.snake_to_camel(Pathname.new(type_info['items']['$ref']).basename('.json').to_s)}.h\""
|
61
61
|
end
|
62
62
|
|
63
63
|
if self.match_type(type_info['type']) == 'NSObject' && type_info['$ref'] != nil && type_info['$ref'] != '#'
|
64
|
-
contains << "#import \"
|
64
|
+
contains << "#import \"#{self.snake_to_camel(Pathname.new(type_info['$ref']).basename('.json').to_s)}.h\""
|
65
65
|
end
|
66
66
|
end
|
67
67
|
contains.uniq
|
@@ -73,12 +73,12 @@ class Parser
|
|
73
73
|
properties.each do |name, type_info|
|
74
74
|
if self.match_type(type_info['type']) == 'NSArray' && type_info['items']['$ref'] != nil
|
75
75
|
extends = type_info['items']['$ref'] != '#' ? self.snake_to_camel(Pathname.new(type_info['items']['$ref']).basename('.json').to_s) : @generated_class
|
76
|
-
array_converters << "+ (NSValueTransformer *)#{name}JSONTransformer\n{\n return [NSValueTransformer mtl_JSONArrayTransformerWithModelClass
|
76
|
+
array_converters << "+ (NSValueTransformer *)#{name}JSONTransformer\n{\n return [NSValueTransformer mtl_JSONArrayTransformerWithModelClass:#{extends}.class];\n}\n"
|
77
77
|
end
|
78
78
|
|
79
79
|
if self.match_type(type_info['type']) == 'NSObject' && type_info['$ref'] != nil
|
80
80
|
extends = type_info['$ref'] != '#' ? self.snake_to_camel(Pathname.new(type_info['$ref']).basename('.json').to_s) : @generated_class
|
81
|
-
array_converters << "+ (NSValueTransformer *)#{name}JSONTransformer\n{\n return [NSValueTransformer mtl_JSONDictionaryTransformerWithModelClass
|
81
|
+
array_converters << "+ (NSValueTransformer *)#{name}JSONTransformer\n{\n return [NSValueTransformer mtl_JSONDictionaryTransformerWithModelClass:#{extends}.class];\n}\n"
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
@@ -128,11 +128,11 @@ class Parser
|
|
128
128
|
|
129
129
|
if type == 'NSObject' && type_info['$ref'] != nil
|
130
130
|
extends = type_info['$ref'] != '#' ? self.snake_to_camel(Pathname.new(type_info['$ref']).basename('.json').to_s) : @generated_class
|
131
|
-
extracted_properties << "@property(#{self.copy_type(type) ? 'copy' : 'assign'}, nonatomic
|
131
|
+
extracted_properties << "@property(#{self.copy_type(type) ? 'copy' : 'assign'}, nonatomic) #{extends} #{self.copy_type(type) ? '*' : ''}#{name};"
|
132
132
|
elsif type == 'NSString' && type_info['format'] == 'date-time'
|
133
|
-
extracted_properties << "@property(strong, nonatomic
|
133
|
+
extracted_properties << "@property(strong, nonatomic) NSDate *#{name};"
|
134
134
|
else
|
135
|
-
extracted_properties << "@property(#{self.copy_type(type) ? 'copy' : 'assign'}, nonatomic
|
135
|
+
extracted_properties << "@property(#{self.copy_type(type) ? 'copy' : 'assign'}, nonatomic) #{type} #{self.copy_type(type) ? '*' : ''}#{name};"
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
@@ -163,13 +163,11 @@ class Parser
|
|
163
163
|
'NSObject'
|
164
164
|
end
|
165
165
|
end
|
166
|
-
|
167
|
-
|
168
|
-
return s[:1].upper() + s[1:]
|
169
|
-
|
166
|
+
|
167
|
+
|
170
168
|
def snake_to_camel(file_name)
|
171
169
|
prefix = "WP"
|
172
|
-
|
170
|
+
(file_name.split('_').length > 1) ? file_name.split('_').map { |w| w.sub(/^./, &:upcase) }.join('') : prefix+file_name.sub(/^./, &:upcase)
|
173
171
|
end
|
174
172
|
|
175
173
|
end
|
data/lib/uppercrust/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wp-uppercrust
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Workpop
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|