appfuel 0.5.12 → 0.5.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/appfuel/domain/entity.rb +32 -9
- data/lib/appfuel/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: 9042cb7e13be9707fd722aa2fd93103b573c8194
|
4
|
+
data.tar.gz: 3c37b1b8ce0dd9f390628d1132a2678142562056
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c98a4ec95b9ecffc0d92a5cf3911b694524318376ea78b4cdc4fe1367c1e3d9e013fe5d1279e405ffae2af0617cec4623f84adb756d29b7f74947f95c5a38d3e
|
7
|
+
data.tar.gz: 9584eb1c0f2d96c2296565ed0725e1f0d5da2ddfeeaaacd1d4963ce359919c8dd18225792c41c2d91d0d664a968ea36ec1b0c90c21eb2d385a12744a2f2a3cf4
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. (Pending ap
|
|
5
5
|
|
6
6
|
|
7
7
|
# Releases
|
8
|
+
## [[0.5.12]](https://github.com/rsb/appfuel/releases/tag/0.5.13) 2017-08-01
|
9
|
+
### Fixed
|
10
|
+
- when you override an entity attribute it fails to initialize when value is
|
11
|
+
undefined
|
12
|
+
|
8
13
|
## [[0.5.12]](https://github.com/rsb/appfuel/releases/tag/0.5.12) 2017-07-31
|
9
14
|
### Fixed
|
10
15
|
- `dynamodb adapter` `index` does not check for existing prefix
|
@@ -189,17 +189,12 @@ module Appfuel
|
|
189
189
|
end
|
190
190
|
|
191
191
|
def initialize_value(key, type, input)
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
# manual overrides have to manually type check themselves
|
196
|
-
setter = "#{key}="
|
197
|
-
return send(setter, input) if respond_to?(setter)
|
198
|
-
|
199
|
-
if input != Types::Undefined && input != nil
|
200
|
-
input = type[input]
|
192
|
+
input = handle_default_value(input, type)
|
193
|
+
if respond_to?("#{key}=")
|
194
|
+
return handle_defined_setter(key, input)
|
201
195
|
end
|
202
196
|
|
197
|
+
input = type_check_value(type, input)
|
203
198
|
instance_variable_set("@#{key}", input)
|
204
199
|
rescue => e
|
205
200
|
msg = "#{domain_name} could not assign :#{key} #{e.message}"
|
@@ -208,6 +203,30 @@ module Appfuel
|
|
208
203
|
raise error
|
209
204
|
end
|
210
205
|
|
206
|
+
def handle_defined_setter(key, input)
|
207
|
+
return if undefined?(input)
|
208
|
+
send("#{key}=", input)
|
209
|
+
end
|
210
|
+
|
211
|
+
def handle_default_value(input, type)
|
212
|
+
return input unless type.default?
|
213
|
+
if undefined?(input) || input.nil?
|
214
|
+
return type[nil]
|
215
|
+
end
|
216
|
+
input
|
217
|
+
end
|
218
|
+
|
219
|
+
def type_check_value(type, input)
|
220
|
+
if !undefined?(input) && !input.nil?
|
221
|
+
input = type[input]
|
222
|
+
end
|
223
|
+
input
|
224
|
+
end
|
225
|
+
|
226
|
+
def setter_defined?(key)
|
227
|
+
respond_to?("#{key}=")
|
228
|
+
end
|
229
|
+
|
211
230
|
def define_getter(key)
|
212
231
|
return if respond_to?(key)
|
213
232
|
define_singleton_method(key) do
|
@@ -232,6 +251,10 @@ module Appfuel
|
|
232
251
|
end
|
233
252
|
|
234
253
|
|
254
|
+
def undefined?(value)
|
255
|
+
Types::Undefined
|
256
|
+
end
|
257
|
+
|
235
258
|
def is_entity?(value, type)
|
236
259
|
value.respond_to?(:domain_name) && value.domain_name == type.domain_name
|
237
260
|
end
|
data/lib/appfuel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appfuel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Scott-Buccleuch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|