ethos 0.2.0.beta11 → 0.2.0.beta12
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 +3 -7
- data/lib/ethos/entity.rb +7 -3
- data/lib/ethos/schema.rb +4 -0
- data/lib/ethos/version.rb +1 -1
- data/spec/ethos/schema.rb +12 -0
- 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: 9b44c823d7d00eff4d50e010996d19f46457eae3
|
4
|
+
data.tar.gz: 3e9bd146f6e5546871207e83a2222bf9abefca5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94e17b1c198ae737124d0c79435a02771978925836c8baa37ac8c03e356f3ab59b911cf2e10830ba2070cb31e0d9810e444d5a36f1fa1b21111a54b6c14b019f
|
7
|
+
data.tar.gz: 4fd8341549a9ecdbb66e110ad5fa958180da49b3814510c381e5f7a6994b1b15e95882dab63eb7d79b2969099e9b31189c534fa9b2211de6209cf920068ac486
|
data/lib/ethos/attributes.rb
CHANGED
@@ -6,10 +6,6 @@ module Ethos
|
|
6
6
|
@_schema
|
7
7
|
end
|
8
8
|
|
9
|
-
def initial
|
10
|
-
@_initial ||= {}
|
11
|
-
end
|
12
|
-
|
13
9
|
def current
|
14
10
|
@_current ||= {}
|
15
11
|
end
|
@@ -18,14 +14,14 @@ module Ethos
|
|
18
14
|
@_schema = schema
|
19
15
|
|
20
16
|
schema.defaults.each do |key, value|
|
21
|
-
|
17
|
+
current[key] = value
|
22
18
|
end
|
23
19
|
|
24
20
|
schema.attributes.keys.each do |key|
|
25
21
|
if values.key? key
|
26
|
-
|
22
|
+
current[key] = values[key]
|
27
23
|
elsif values.key? String key
|
28
|
-
|
24
|
+
current[key] = values[String key]
|
29
25
|
end
|
30
26
|
end
|
31
27
|
end
|
data/lib/ethos/entity.rb
CHANGED
@@ -25,12 +25,16 @@ module Ethos
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def collection(key, type)
|
28
|
-
attribute key, Ethos::Collection, nothing: []
|
29
|
-
|
30
|
-
|
28
|
+
attribute key, Ethos::Collection, nothing: [] do
|
29
|
+
self.type = type
|
30
|
+
end
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
def self.included(base)
|
35
|
+
base.extend ClassMethods
|
36
|
+
end
|
37
|
+
|
34
38
|
def self.prepended(base)
|
35
39
|
base.extend ClassMethods
|
36
40
|
end
|
data/lib/ethos/schema.rb
CHANGED
data/lib/ethos/version.rb
CHANGED
data/spec/ethos/schema.rb
CHANGED
@@ -29,3 +29,15 @@ scope do
|
|
29
29
|
asserts(schema.defaults).key? :value
|
30
30
|
end
|
31
31
|
end
|
32
|
+
|
33
|
+
scope do
|
34
|
+
setup do
|
35
|
+
schema.define :a, Integer
|
36
|
+
schema.define :b, Integer
|
37
|
+
schema.define :c, Integer
|
38
|
+
end
|
39
|
+
|
40
|
+
spec do
|
41
|
+
asserts(schema.keys) == %i[a b c]
|
42
|
+
end
|
43
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ethos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.
|
4
|
+
version: 0.2.0.beta12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erol Fornoles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|