mixture 0.3.6 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b2b9aac90a35e8c7a8fa158571cf3d3a71089aa
4
- data.tar.gz: cb128e660ba6b94b21abbad509c9b8ab552fd684
3
+ metadata.gz: cdcfd77ffa0853daa936e5a7e7c10d18dcc12bd6
4
+ data.tar.gz: acb4173454fe8c014f33d6b43f489f9cba7338f4
5
5
  SHA512:
6
- metadata.gz: 2842a8c7f634943157a2df5d3e11ae334b46fc9e1f9934d9fdd2c120266ce252115e895e220c588f89a29d929d572254d8ee66e8cbf068da83acd5cc67a102a7
7
- data.tar.gz: b86867c04e4a0df40f4eeac7da81ff678f0de751c929400290f63de5da25cc4a3cc67f14c27600ed29264362a11d7a686b7955bfeb8a5e85a81f3695a8eef473
6
+ metadata.gz: fb75c08641030b0c5acc22a1a51bc21cdb122fde7a3cdd5d8ffd6b19f1ae2014cf56bddc46cda61239c8c65baeb1e4ea2c2cf2f8c7cf6f5f5ac1ccd7f593ecc4
7
+ data.tar.gz: e425fa998b3198e7f9c43123a757700de9635063505c5ca6b588c58aecc6696d41ee1f48bdf70c7b781c47006f55e29d62bf406bf5d2abb0fafa947fb0a7ec75
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mixture (0.3.6)
4
+ mixture (0.4.0)
5
5
  thread_safe (~> 0.3)
6
6
 
7
7
  GEM
@@ -7,6 +7,12 @@ module Mixture
7
7
  type Types::Class
8
8
 
9
9
  coerce_to(Types::Object, Itself)
10
+ coerce_to(Types::Class) do |value, type|
11
+ member = type.options.fetch(:members).first
12
+ fail CoercionError, "Cannot coerce #{value.class} =>" \
13
+ " #{member}" unless value.is_a?(member)
14
+ value
15
+ end
10
16
  end
11
17
  end
12
18
  end
@@ -1,8 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
+
3
4
  require "mixture/coerce/base"
4
- require "mixture/coerce/date"
5
5
  require "mixture/coerce/array"
6
+ require "mixture/coerce/class"
7
+ require "mixture/coerce/date"
6
8
  require "mixture/coerce/datetime"
7
9
  require "mixture/coerce/float"
8
10
  require "mixture/coerce/hash"
@@ -7,7 +7,7 @@ module Mixture
7
7
  class Class < Object
8
8
  options[:primitive] = ::Class
9
9
  options[:noinfer] = true
10
- options[:member] = Object
10
+ options[:members] = [Object]
11
11
  options[:method] = :to_class
12
12
  options[:types] = ThreadSafe::Cache.new
13
13
  extend Access
data/lib/mixture/types.rb CHANGED
@@ -93,8 +93,8 @@ require "mixture/types/access"
93
93
  require "mixture/types/object"
94
94
  require "mixture/types/enumerable"
95
95
  require "mixture/types/collection"
96
- require "mixture/types/class"
97
96
  require "mixture/types/boolean"
97
+ require "mixture/types/class"
98
98
  require "mixture/types/numeric"
99
99
  require "mixture/types/array"
100
100
  require "mixture/types/date"
@@ -5,5 +5,5 @@ module Mixture
5
5
  # The current version of Mixture.
6
6
  #
7
7
  # @return [String]
8
- VERSION = "0.3.6"
8
+ VERSION = "0.4.0"
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixture
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Rodi