katana_resource 0.7.3 → 0.7.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdc2f296693e1bb4303f95ba26738db4bfc9b0f2
|
4
|
+
data.tar.gz: 9894801f1b5545f7eab26c5b37f7712ff911c3bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfa5b584240ab00e451cda1407d866ac247bbacfba6bc6bed184d80e55fb4b39a0e966fbfeec11e4ad224614631156b70efff2816bb47b9aa9a0c452813fd266
|
7
|
+
data.tar.gz: a443f373250a87e7f48a0872e1dbf010b41b647ee1900402aae1bbdbbd39a9f5d238e3085508c91861f88ad13f4d3e17de64bc75ca685dea1e50f6a21ce12408
|
data/app/models/bicycle.rb
CHANGED
@@ -121,12 +121,15 @@ module KatanaResource
|
|
121
121
|
when type_name_for_attribute(name) == "Integer" then value.to_i
|
122
122
|
when type_name_for_attribute(name) == "Float" then value.to_f
|
123
123
|
when type_name_for_attribute(name) == "Boolean" then Boolean.new(value).bool_val
|
124
|
+
|
124
125
|
when defined?(type_for_attribute(name))
|
125
126
|
|
126
127
|
# This will be true if we're decoding the record from disc rather than loading
|
127
128
|
# from server
|
128
129
|
# TODO: Refacator this...
|
129
130
|
if value.is_a?(KatanaResource::Base)
|
131
|
+
value.attributes ||= {}
|
132
|
+
|
130
133
|
return value
|
131
134
|
end
|
132
135
|
return_val = [value].flatten.map { |atts| type_for_attribute(name).new(atts) }
|
data/lib/katana_resource/base.rb
CHANGED
@@ -28,6 +28,7 @@ module KatanaResource
|
|
28
28
|
include KatanaResource::UrlEncoding
|
29
29
|
|
30
30
|
def initialize(attributes = {})
|
31
|
+
attributes ||= {}
|
31
32
|
attributes = attributes.with_indifferent_access
|
32
33
|
self.class.resource_attributes.each do |resource_att|
|
33
34
|
next unless attributes[resource_att.name]
|
@@ -19,17 +19,21 @@ module KatanaResource
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def current_path
|
22
|
-
(App.documents_path
|
22
|
+
@current_path ||= File.join(App.documents_path, "#{name}.current").to_s.freeze
|
23
23
|
end
|
24
24
|
|
25
25
|
def save_current(value = nil)
|
26
|
-
|
27
|
-
|
26
|
+
if value
|
27
|
+
self.current = value
|
28
|
+
NSKeyedArchiver.archiveRootObject(current, toFile: current_path)
|
29
|
+
else
|
30
|
+
clear_current
|
31
|
+
end
|
28
32
|
end
|
29
33
|
|
30
34
|
def clear_current
|
31
35
|
self.current = nil
|
32
|
-
|
36
|
+
File.delete(current_path) if File.exist?(current_path)
|
33
37
|
end
|
34
38
|
|
35
39
|
def load_current
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: katana_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bodacious
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: motion-require
|