ethos 0.2.0.beta1 → 0.2.0.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +10 -0
- data/Rakefile +6 -0
- data/ethos.gemspec +1 -0
- data/lib/ethos/attributes.rb +1 -1
- data/lib/ethos/entity.rb +3 -3
- data/lib/ethos/schema.rb +1 -1
- data/lib/ethos/version.rb +1 -1
- data/spec/ethos/attributes.rb +4 -10
- data/spec/ethos/entity.rb +5 -5
- data/spec/ethos/schema.rb +2 -8
- data/spec/ethos/type.rb +2 -2
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48025a24e4808b486dda4d900c8dba809eaa3ad2
|
4
|
+
data.tar.gz: 64e974f41db04e23ac4c78de7daf80396c7112b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 888d41438ddd11d02ea08abdd268a76c0e2c7e90eca336eb2a22974fb52f2a5146d5966977ee947c7787eb17696780a78ee635efcc4ebfe5f2cc5d3ad83029ef
|
7
|
+
data.tar.gz: 6a48897c89b488b756c8733db838b339169557cedd0c412c70416f479f323419c4846ee9f2421aa21f0dd56feb79d0c393192850eff8cb80af40a8a18d707077
|
data/.travis.yml
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.1.5
|
4
|
+
- 2.2.0
|
5
|
+
env:
|
6
|
+
- CODECLIMATE_REPO_COVERAGE=true
|
7
|
+
addons:
|
8
|
+
code_climate:
|
9
|
+
repo_token:
|
10
|
+
secure: "gu+A69oYmhfRWj3jDkqZBRw/iwbJ8sDqusuZ7uaotXtPOsn9tgAIFa/3LzTEFf3KZnnE4BkSAbphUmb7XhQrelDSXy2XEtlbBjuAdcKpRbHF7eGbOAsUFy7YjzYLNjuxYrtzBnOeEnldWzGMaueRrdlmF7Hg4MZgMYb6rLPNZzM="
|
data/Rakefile
CHANGED
data/ethos.gemspec
CHANGED
data/lib/ethos/attributes.rb
CHANGED
data/lib/ethos/entity.rb
CHANGED
@@ -8,8 +8,8 @@ module Ethos
|
|
8
8
|
@_schema ||= Ethos::Schema.new
|
9
9
|
end
|
10
10
|
|
11
|
-
def attribute(key, type
|
12
|
-
schema.define key, type
|
11
|
+
def attribute(key, type, default: nil)
|
12
|
+
schema.define key, type, default: default
|
13
13
|
|
14
14
|
reader = :"#{key}"
|
15
15
|
writer = :"#{key}="
|
@@ -32,7 +32,7 @@ module Ethos
|
|
32
32
|
schema = self.class.schema
|
33
33
|
values = values.merge schema.defaults
|
34
34
|
|
35
|
-
@_attributes = Ethos::Attributes.new schema
|
35
|
+
@_attributes = Ethos::Attributes.new schema, values: values
|
36
36
|
|
37
37
|
super()
|
38
38
|
end
|
data/lib/ethos/schema.rb
CHANGED
data/lib/ethos/version.rb
CHANGED
data/spec/ethos/attributes.rb
CHANGED
@@ -3,18 +3,12 @@ require 'ethos/attributes'
|
|
3
3
|
|
4
4
|
define schema: -> do
|
5
5
|
schema = Ethos::Schema.new
|
6
|
-
schema.define :value,
|
6
|
+
schema.define :value, Integer
|
7
7
|
schema
|
8
8
|
end
|
9
9
|
|
10
|
-
spec do
|
11
|
-
raises ArgumentError, 'missing keyword: schema' do
|
12
|
-
Ethos::Attributes.new
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
10
|
scope do
|
17
|
-
define attributes: -> { Ethos::Attributes.new schema
|
11
|
+
define attributes: -> { Ethos::Attributes.new schema }
|
18
12
|
|
19
13
|
spec do
|
20
14
|
asserts(attributes[:value]) == nil
|
@@ -35,13 +29,13 @@ end
|
|
35
29
|
|
36
30
|
scope do
|
37
31
|
spec do
|
38
|
-
attributes = Ethos::Attributes.new schema
|
32
|
+
attributes = Ethos::Attributes.new schema, values: {value: 1}
|
39
33
|
|
40
34
|
asserts(attributes[:value]) == 1
|
41
35
|
end
|
42
36
|
|
43
37
|
spec do
|
44
|
-
attributes = Ethos::Attributes.new schema
|
38
|
+
attributes = Ethos::Attributes.new schema, values: {value: '1'}
|
45
39
|
|
46
40
|
asserts(attributes[:value]) == 1
|
47
41
|
end
|
data/spec/ethos/entity.rb
CHANGED
@@ -5,7 +5,7 @@ scope do
|
|
5
5
|
class Entity
|
6
6
|
prepend Ethos::Entity
|
7
7
|
|
8
|
-
attribute :value,
|
8
|
+
attribute :value, Integer
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -33,7 +33,7 @@ scope do
|
|
33
33
|
class Entity
|
34
34
|
prepend Ethos::Entity
|
35
35
|
|
36
|
-
attribute :value,
|
36
|
+
attribute :value, Integer, default: 1
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -49,7 +49,7 @@ scope do
|
|
49
49
|
class Entity
|
50
50
|
prepend Ethos::Entity
|
51
51
|
|
52
|
-
attribute :value,
|
52
|
+
attribute :value, Integer, default: '1'
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -65,8 +65,8 @@ scope do
|
|
65
65
|
class Entity
|
66
66
|
prepend Ethos::Entity
|
67
67
|
|
68
|
-
attribute :name,
|
69
|
-
attribute :parent,
|
68
|
+
attribute :name, String
|
69
|
+
attribute :parent, Entity
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
data/spec/ethos/schema.rb
CHANGED
@@ -2,15 +2,9 @@ require 'ethos/schema'
|
|
2
2
|
|
3
3
|
define schema: -> { Ethos::Schema.new }
|
4
4
|
|
5
|
-
spec do
|
6
|
-
raises ArgumentError, 'missing keyword: type' do
|
7
|
-
schema.define :value
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
5
|
scope do
|
12
6
|
setup do
|
13
|
-
schema.define :value,
|
7
|
+
schema.define :value, Integer
|
14
8
|
end
|
15
9
|
|
16
10
|
spec do
|
@@ -24,7 +18,7 @@ end
|
|
24
18
|
|
25
19
|
scope do
|
26
20
|
setup do
|
27
|
-
schema.define :value,
|
21
|
+
schema.define :value, Integer, default: 1
|
28
22
|
end
|
29
23
|
|
30
24
|
spec do
|
data/spec/ethos/type.rb
CHANGED
@@ -76,7 +76,7 @@ scope '.cast' do
|
|
76
76
|
class Entity
|
77
77
|
prepend Ethos::Entity
|
78
78
|
|
79
|
-
attribute :value,
|
79
|
+
attribute :value, Float
|
80
80
|
end
|
81
81
|
|
82
82
|
values = {value: 1}
|
@@ -92,7 +92,7 @@ scope '.cast' do
|
|
92
92
|
class Entity
|
93
93
|
prepend Ethos::Entity
|
94
94
|
|
95
|
-
attribute :value,
|
95
|
+
attribute :value, Float
|
96
96
|
end
|
97
97
|
|
98
98
|
expected = nil
|
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.beta2
|
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-02-
|
11
|
+
date: 2015-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: codeclimate-test-reporter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: Lightweight entity library for Ruby
|
56
70
|
email:
|
57
71
|
- erol.fornoles@gmail.com
|
@@ -60,6 +74,7 @@ extensions: []
|
|
60
74
|
extra_rdoc_files: []
|
61
75
|
files:
|
62
76
|
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
63
78
|
- Gemfile
|
64
79
|
- LICENSE.txt
|
65
80
|
- README.md
|