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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45ac18c350c41a5fca98b4a335f8e44b4fcdfc28
4
- data.tar.gz: ec2a3fff7792a68c4389138047fd494de1db5c7d
3
+ metadata.gz: 78102c85e5215554c1ad6fe09584fb2c2900d577
4
+ data.tar.gz: ba7b2fc9887a3ed42640d6f7109011f051aae6d3
5
5
  SHA512:
6
- metadata.gz: 78c5fc6755aeeceb74bc88e50283689cc0f819214d3da275b1408b0ce7f6b776e930498b70fc1ade5ead2129060acf9db92644cb6291a23e9fc7624f6883efec
7
- data.tar.gz: 78a3ee2e1785424e121c1ef91e69271d2537a4f94b0f70224c8e13c74d1c2e0d82f0a6fc298fea04b829c223bb6003e9e63ff5ebf02ddb485948f6ea5e2d6abb
6
+ metadata.gz: 33142374fd80687db5dcfb0c08dfb6d9711c74cf02ebeba373d4eb37fdeb3f6b861cebf13a29f5e700e45665c683e5e4ddb13c5df72bb90c5ba3e91f4c533b16
7
+ data.tar.gz: fc46e34c360f50fb1fbb25f9954075dd6f0611646eec417e7b8a0c6775d4dd8ee9145cbeb51788e951e81e263b75307d14ab8d37bd89e15fc1190495a27f07dc
@@ -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 \"_#{self.snake_to_camel(Pathname.new(type_info['items']['$ref']).basename('.json').to_s)}.h\""
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 \"_#{self.snake_to_camel(Pathname.new(type_info['$ref']).basename('.json').to_s)}.h\""
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:_#{extends}.class];\n}\n"
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:_#{extends}.class];\n}\n"
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, readonly) _#{extends} #{self.copy_type(type) ? '*' : ''}#{name};"
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, readonly) NSDate *#{name};"
133
+ extracted_properties << "@property(strong, nonatomic) NSDate *#{name};"
134
134
  else
135
- extracted_properties << "@property(#{self.copy_type(type) ? 'copy' : 'assign'}, nonatomic, readonly) #{type} #{self.copy_type(type) ? '*' : ''}#{name};"
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
- def upcase_first_letter(s):
168
- return s[:1].upper() + s[1:]
169
-
166
+
167
+
170
168
  def snake_to_camel(file_name)
171
169
  prefix = "WP"
172
- (file_name.split('_').length > 1) ? file_name.split('_').map { |w| upcase_first_letter(w) }.join('') : prefix+upcase_first_letter(file_name)
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
@@ -1,3 +1,3 @@
1
1
  module Uppercrust
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.5"
3
3
  end
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.3
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-13 00:00:00.000000000 Z
11
+ date: 2017-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor