ethos 0.2.0.beta9 → 0.2.0.beta10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c2f6a1140e86c69125e19a29e1311e8f04e1fdc
4
- data.tar.gz: 007a0305bcc6e6fc0d12dd2641d963aed721982c
3
+ metadata.gz: 19ef51a80ed7e8e3fb2045448dc275aaa4ea5681
4
+ data.tar.gz: 646c11a4562490daf0e42c7bba3955b652b59aff
5
5
  SHA512:
6
- metadata.gz: cf2dc5f9078df0a69884104d8a6594a65b91ed65805bc3168979768d991ba1930193f31324bbe5842f57a74de7dbfe938c06234ab6f02e102bb3267352551e30
7
- data.tar.gz: 0d63dd3628d6fd94d2c42ecfd9863db4b37ff2356cbe42bd9c135df293182ef571e4b3d2722250a853ad723bf3ecc76991b5265908b138d5687448a0260cd0c5
6
+ metadata.gz: 33752ccbcfd4ffebec355244b0705cff6151077066dfb2f40bc2206d74c21cd70b4430f55b65983487b52de57bbcb8ae6790878da7d2fffe1c655b98b2aadf48
7
+ data.tar.gz: 55cbd2c752db32f19830105c09cb5bef80cf2b308069ca43b933afd6a21740ef095db38628ad35a1f641a0fb08c8ba7e6ac2f0883530436773b615362550f787
@@ -2,6 +2,8 @@ require 'date'
2
2
  require 'time'
3
3
  require 'bigdecimal'
4
4
 
5
+ require 'ethos/types/boolean'
6
+
5
7
  module Ethos
6
8
  module Type
7
9
  CASTS = {}
@@ -24,6 +26,10 @@ module Ethos
24
26
  end
25
27
  end
26
28
 
29
+ Ethos::Type.define Ethos::Types::Boolean do |value|
30
+ value ? true : false
31
+ end
32
+
27
33
  Ethos::Type.define Symbol do |value|
28
34
  value.to_sym
29
35
  end
@@ -0,0 +1,6 @@
1
+ module Ethos
2
+ module Types
3
+ class Boolean
4
+ end
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module Ethos
2
- VERSION = '0.2.0.beta9'
2
+ VERSION = '0.2.0.beta10'
3
3
  end
@@ -2,6 +2,32 @@ require 'ethos/type'
2
2
  require 'ethos/entity'
3
3
 
4
4
  scope '.cast' do
5
+ scope 'casts a value to a Ethos::Types::Boolean' do
6
+ spec do
7
+ result = Ethos::Type.cast true, Ethos::Types::Boolean
8
+
9
+ asserts(result).truthy?
10
+ end
11
+
12
+ spec do
13
+ result = Ethos::Type.cast 1, Ethos::Types::Boolean
14
+
15
+ asserts(result).truthy?
16
+ end
17
+
18
+ spec do
19
+ result = Ethos::Type.cast false, Ethos::Types::Boolean
20
+
21
+ asserts(result).falsey?
22
+ end
23
+
24
+ spec do
25
+ result = Ethos::Type.cast nil, Ethos::Types::Boolean
26
+
27
+ asserts(result).falsey?
28
+ end
29
+ end
30
+
5
31
  spec 'casts a value to a Symbol' do
6
32
  expected = :Symbol
7
33
  result = Ethos::Type.cast 'Symbol', Symbol
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.beta9
4
+ version: 0.2.0.beta10
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-13 00:00:00.000000000 Z
11
+ date: 2015-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,6 +86,7 @@ files:
86
86
  - lib/ethos/entity.rb
87
87
  - lib/ethos/schema.rb
88
88
  - lib/ethos/type.rb
89
+ - lib/ethos/types/boolean.rb
89
90
  - lib/ethos/version.rb
90
91
  - spec/.gitkeep
91
92
  - spec/ethos/attributes.rb