reynard 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reynard/model.rb +12 -3
- data/lib/reynard/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf9800ba5e9413a1b15f0e7ba1a670b445c3bd3ad17d4d4229b68f9edbb1d2ce
|
4
|
+
data.tar.gz: 28dffe4ecfc842642f88d8d091e0acfb7b11f706a80504f2e9caf0fd983a0695
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 272402519908855f09f368efa5d3e0e85791e48b5f86bd2ddee66b8418aea9f686192ca7bacc1eae233b87fc6b821303f3771a8e784bc762a028d22bc2520058
|
7
|
+
data.tar.gz: 17481196746340a8caed347dc249cd4e2c59b421e999edc50700631741d4aa4ce2a8c4577e8b41fc61ba2feeb0cc22f2b4d86c321d532d26c8d3c1291606ba6a
|
data/lib/reynard/model.rb
CHANGED
@@ -14,9 +14,17 @@ class Reynard
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def initialize(attributes)
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
if attributes.respond_to?(:each)
|
18
|
+
@attributes = {}
|
19
|
+
@snake_cases = self.class.snake_cases(attributes.keys)
|
20
|
+
self.attributes = attributes
|
21
|
+
else
|
22
|
+
raise(
|
23
|
+
ArgumentError,
|
24
|
+
'Models must be initialized with an enumerable object that behaves like a hash, got: ' \
|
25
|
+
"`#{attributes.inspect}'"
|
26
|
+
)
|
27
|
+
end
|
20
28
|
end
|
21
29
|
|
22
30
|
def attributes=(attributes)
|
@@ -47,6 +55,7 @@ class Reynard
|
|
47
55
|
end
|
48
56
|
|
49
57
|
def self.cast(name, value)
|
58
|
+
return if value.nil?
|
50
59
|
return value unless schema
|
51
60
|
|
52
61
|
property = schema.property_schema(name)
|
data/lib/reynard/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reynard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manfred Stienstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|