dry-types-tuple 0.1.2 → 0.1.4

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: 3ff4a6208f9f1d2b30e3956b6493cc13e20f095d86c5be454f201fbdea0316dc
4
- data.tar.gz: d4ec021dc5a952a6d238af76a05df9d573643169d1ada1e6ad4823fb63cfcd0b
3
+ metadata.gz: fd3228e18cf0642b5270041045dcd053ab2ae71b46246420e1a58f0c3fb1dda7
4
+ data.tar.gz: 58e0adf146063babf2b35beeabcfda9f531f2c00b1075fa7f5e017d6c5cd00ae
5
5
  SHA512:
6
- metadata.gz: e50016534bb0db3324c8cdd2640a11595fb990c58b43228368e22dc87ca981557cc0c2d286c68aacbb73b2bc55e0869531e3ec88eab91551930c89aaf719cff4
7
- data.tar.gz: 62c1d224167979f49826e960100699e944afecd0cc1a31479c0aef31f12efe9834e9bb8d6baaa0d6fde11745ed1b426743dc4442153439e883c816a7d80ca188
6
+ metadata.gz: 29847469e31c10ead9a61e7afedf3ddc98b1b2dd9cea975237d0a72642778b93dbe4bca20230c28ef511809d67471d86ead90165468da1744df510ab2e11fe5f
7
+ data.tar.gz: 96b53068b51630699c1c6e5c943c9671da97b0b15d09c8286929a51105a24e0e6ec2c2f89a89c2cba88239e9d37cb1bb12b91ac7dd471f4546e705a3b7f68e61
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "dry-types-tuple"
5
- spec.version = '0.1.2'
5
+ spec.version = '0.1.4'
6
6
  spec.authors = ["Anton"]
7
7
  spec.email = ["anton.estum@gmail.com"]
8
8
 
data/lib/dry/tuple.rb CHANGED
@@ -24,13 +24,6 @@ module Dry
24
24
  module Tuple
25
25
  # Pure class type decorator mixin.
26
26
  module ClassDecorator
27
- include Types::Decorator
28
-
29
- # @return [@tuple]
30
- def type
31
- @tuple
32
- end
33
-
34
27
  # @param input [Array] the result of {#coerce_tuple}
35
28
  # @return [self]
36
29
  # @abstract
@@ -103,8 +96,14 @@ module Dry
103
96
  include Core::ClassAttributes
104
97
  include Types::Type
105
98
  include Types::Builder
99
+ include Types::Decorator
106
100
  include ClassDecorator
107
101
  extend HookExtendObject
102
+
103
+ # @return [@tuple]
104
+ def type
105
+ @tuple
106
+ end
108
107
  end
109
108
 
110
109
  # Extracted due to make it possible to use this feature within {Dry::Struct} classes.
@@ -128,6 +127,14 @@ module Dry
128
127
  end
129
128
  end
130
129
 
130
+ def try(input, &block)
131
+ if input.is_a?(::Array)
132
+ @tuple.try(input, &block)
133
+ else
134
+ super(input, &block)
135
+ end
136
+ end
137
+
131
138
  def auto_tuple(*keys)
132
139
  keys_order(keys_order | keys)
133
140
  index = schema.keys.map { |t| [t.name, t.type] }.to_h
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-types-tuple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton