uinit-type 0.1.1 → 0.1.3

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
  SHA256:
3
- metadata.gz: 31a74587cea1d8bbf1d3e6e5d29850303c6ce319fadb0f9c6967d278040d12be
4
- data.tar.gz: d671e387cc6793656a9f5b32c30aa5db37c6b9606df883b7c5788f9f72174361
3
+ metadata.gz: 24e0c467351a77c8c49cbe9bd8012902d553c02b2a068d78f4267876b18d0673
4
+ data.tar.gz: cadc2bb0c1226c212d8cdefdc26090a6a2180d8a5603bf9792fc23dfb2ee6896
5
5
  SHA512:
6
- metadata.gz: a461fa8a15247c09336a8b4342f437e28ba509ca5ca00765abe77fe5c503804bf05797aa749bbe52cd4d67040c7e2306a468f2a16d68aef0122cb65ae022fd7a
7
- data.tar.gz: 74aa457314cedb6ad1d9545112b2aae6cbeee66e47323e7d118386b7907b9e2accd4f8c41b2d036a91ee67faf3c817ea946709c809c6aa5cd106c03cd93f7705
6
+ metadata.gz: 98665f640c4d146830cc2fe4dd3b2af809af031d9eb56b57628a00d9edc45e31177d221c13cc5d203bd5dcdc83dc207d0e995a08b869ef94286fd64bc84c66ff
7
+ data.tar.gz: b7db5aee9085482bf5babd0f30ee6952eedface4657548edec4d7927fe5d1b4f8165a4548205fcdbc663236405b15a2a9d54ed8903aa427541f4ebaa2ae9931c
@@ -48,8 +48,8 @@ module Uinit
48
48
  SetOf.new(type)
49
49
  end
50
50
 
51
- def extends(type)
52
- Extend.new(type)
51
+ def type_of(type)
52
+ TypeOf.new(type)
53
53
  end
54
54
 
55
55
  def nilable
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Uinit
4
4
  module Type
5
- class Extend < Base
5
+ class TypeOf < Base
6
6
  def self.from?(value)
7
7
  value.is_a?(Class) || value.is_a?(Module)
8
8
  end
@@ -33,7 +33,7 @@ module Uinit
33
33
 
34
34
  return value if value.ancestors.include?(class_module)
35
35
 
36
- type_error!("#{value.inspect} does not extend #{class_module}", depth)
36
+ type_error!("#{value.inspect} does not extend or include or preprend #{class_module}", depth)
37
37
  end
38
38
 
39
39
  def inspect
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Uinit
4
4
  module Type
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.3'
6
6
  end
7
7
  end
data/lib/uinit/type.rb CHANGED
@@ -21,7 +21,7 @@ module Uinit
21
21
 
22
22
  def self.from(arg)
23
23
  klass =
24
- [Base, Instance, ArrayOf, SetOf, HashOf, Check, Const].find do |type_class|
24
+ [Base, Instance, ArrayOf, SetOf, HashOf, Check, TypeOf, Const].find do |type_class|
25
25
  type_class.from?(arg)
26
26
  end
27
27
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uinit-type
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kimoja
@@ -112,7 +112,6 @@ files:
112
112
  - lib/uinit/type/const.rb
113
113
  - lib/uinit/type/context.rb
114
114
  - lib/uinit/type/error.rb
115
- - lib/uinit/type/extend.rb
116
115
  - lib/uinit/type/extensions.rb
117
116
  - lib/uinit/type/fn.rb
118
117
  - lib/uinit/type/generic.rb
@@ -121,6 +120,7 @@ files:
121
120
  - lib/uinit/type/instance.rb
122
121
  - lib/uinit/type/operators.rb
123
122
  - lib/uinit/type/set_of.rb
123
+ - lib/uinit/type/type_of.rb
124
124
  - lib/uinit/type/version.rb
125
125
  - uinit-type.gemspec
126
126
  homepage: https://github.com/Kimoja/uinit-type