ethos 0.2.0.beta3 → 0.2.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ethos/attributes.rb +7 -0
- data/lib/ethos/entity.rb +1 -4
- data/lib/ethos/schema.rb +4 -0
- data/lib/ethos/version.rb +1 -1
- data/spec/ethos/entity.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be315115b1c5686fe19970b30ad0ab222745981d
|
4
|
+
data.tar.gz: 7aebb378346adbb1a0aa2c46fa1f9c275a520cd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a87b14e54f833fa83bdd67e1d06545db7a76feaea8f8e0528a6030bc86144b96f629ea3784bae3a37af3c5ad51658746f31555b19b72bf72d32ac6b08334e5ce
|
7
|
+
data.tar.gz: 6cd180a3fb63901b7c01d7590ed6c067ea5fa3f554982d96d663cd26a87f6fc8e9fcf081b59b164b20cb47f0c0ad95579c058fb89f60379a467dfbe54eba9806
|
data/lib/ethos/attributes.rb
CHANGED
@@ -17,9 +17,16 @@ module Ethos
|
|
17
17
|
def initialize(schema, values: {})
|
18
18
|
@_schema = schema
|
19
19
|
|
20
|
+
schema.defaults.each do |key, value|
|
21
|
+
initial[key] = value
|
22
|
+
current[key] = value
|
23
|
+
end
|
24
|
+
|
20
25
|
values.each do |key, value|
|
21
26
|
key = key.to_sym
|
22
27
|
|
28
|
+
next unless schema.defined? key
|
29
|
+
|
23
30
|
initial[key] = value
|
24
31
|
current[key] = value
|
25
32
|
end
|
data/lib/ethos/entity.rb
CHANGED
@@ -29,10 +29,7 @@ module Ethos
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def initialize(values = {})
|
32
|
-
|
33
|
-
values = values.merge schema.defaults
|
34
|
-
|
35
|
-
@_attributes = Ethos::Attributes.new schema, values: values
|
32
|
+
@_attributes = Ethos::Attributes.new self.class.schema, values: values
|
36
33
|
|
37
34
|
super()
|
38
35
|
end
|
data/lib/ethos/schema.rb
CHANGED
data/lib/ethos/version.rb
CHANGED
data/spec/ethos/entity.rb
CHANGED