restkit-generate 0.2 → 0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/restkit-generate/h.rb
CHANGED
|
@@ -5,7 +5,7 @@ module RestKitGenerate
|
|
|
5
5
|
model_name = RestKitGenerate.config[:model_name]
|
|
6
6
|
prefix = RestKitGenerate.config[:prefix]
|
|
7
7
|
core_data = RestKitGenerate.config[:core_data]
|
|
8
|
-
RestKitGenerate.properties.each{|key, value| props << "@property (
|
|
8
|
+
RestKitGenerate.properties.each{|key, value| props << "@property (#{value[:type] == "NSString" ? "copy" : "strong"}, nonatomic) #{value[:type]} *#{key};" }
|
|
9
9
|
|
|
10
10
|
erb = ERB.new(File.read(File.join($lib, 'restkit-generate', !core_data ? 'nsobject.h.erb' : 'nsmanagedobject.h.erb')))
|
|
11
11
|
result = erb.result(binding)
|
data/lib/restkit-generate/m.rb
CHANGED
|
@@ -11,7 +11,7 @@ module RestKitGenerate
|
|
|
11
11
|
core_data = RestKitGenerate.config[:core_data]
|
|
12
12
|
|
|
13
13
|
RestKitGenerate.properties.each{|key, value| dynamic << key }
|
|
14
|
-
RestKitGenerate.properties.each{|key, value| mapping << "#{tab}@\"#{value[:original_name]}\"
|
|
14
|
+
RestKitGenerate.properties.each{|key, value| mapping << "#{tab}#{tab}@\"#{value[:original_name]}\": @\"#{key}\"" }
|
|
15
15
|
RestKitGenerate.properties.each{|key, value| decoders << "#{tab}[coder encodeObject:self.#{key} forKey:@\"#{key}\"];" }
|
|
16
16
|
RestKitGenerate.properties.each{|key, value| encoders << "#{tab}#{tab}self.#{key} = [coder decodeObjectForKey:@\"#{key}\"];" }
|
|
17
17
|
|
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
|
|
9
9
|
@dynamic <%= dynamic.join(", ") %>;
|
|
10
10
|
|
|
11
|
-
+ (
|
|
11
|
+
+ (RKEntityMapping *)objectMapping
|
|
12
12
|
{
|
|
13
|
-
|
|
13
|
+
RKEntityMapping *mapping = [RKEntityMapping mappingForEntityForName:@"<%= model_name %>" inManagedObjectStore:[RKObjectManager sharedManager].managedObjectStore];
|
|
14
14
|
<%
|
|
15
15
|
unless RestKitGenerate.config[:primary_key].nil?
|
|
16
16
|
%>
|
|
17
|
-
mapping.
|
|
17
|
+
mapping.identificationAttributes = @[ @"<%= RestKitGenerate.config[:primary_key] %>" ];
|
|
18
18
|
<%
|
|
19
19
|
end
|
|
20
20
|
%>
|
|
21
|
-
[mapping
|
|
21
|
+
[mapping addAttributeMappingsFromDictionary:@{
|
|
22
22
|
<%= mapping.join(",\n") %>,
|
|
23
|
-
|
|
23
|
+
}];
|
|
24
24
|
return mapping;
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
+ (RKObjectMapping *)objectMapping
|
|
10
10
|
{
|
|
11
11
|
RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[self class]];
|
|
12
|
-
[mapping
|
|
12
|
+
[mapping addAttributeMappingsFromDictionary:@{
|
|
13
13
|
<%= mapping.join(",\n") %>,
|
|
14
|
-
|
|
14
|
+
}];
|
|
15
15
|
return mapping;
|
|
16
16
|
}
|
|
17
17
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: restkit-generate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.3'
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2013-02-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: A model generator for iOS RestKit (Rails-like)
|
|
15
15
|
email: romefimov@gmail.com
|