dry-interface 1.0.3 → 1.0.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: 843c9c803f7b4120ee153b239ef059412f8b190b30c19035cb40d7b7fc841f43
4
- data.tar.gz: 52f0f9948370e76e25c22fba7584c785df511290776dbfdf8ef88f697bd00774
3
+ metadata.gz: 4079619043b7b01b90eb4b6def6b3c6ce28280bbb9597d0bb62ee4791fc37110
4
+ data.tar.gz: bef3b4af52fb863ab59402ab196f0909bffbfc3408c3898976f07d47d13c3813
5
5
  SHA512:
6
- metadata.gz: 9720f18422181f581ab0a2a002a85bd3c930ab2882f68f60127365be257318f5a0954edad26dbd07acef26fa010b103f1da90320499a4e1e43dbe2520513a1ce
7
- data.tar.gz: 4fef9a25bb9f73606e905ed850db1fff1eb6d2ab0a433b3e43e628d85f8784314f52fdeb4a2cc77f7ce88a164d3147ad94f53a0792b29b3db13e68acad03b6cf
6
+ metadata.gz: 8770345dae87d66406df5d677ecde817b69384d0ae1a7ebe355528d45e2800856821463349fdd262d1240231fb0f94d54f946d72b3160286087bb059b63e827b
7
+ data.tar.gz: dd28081ce094249862cffb93325908c90a813eac687c74f95ad91441db9493917fb84d5f15c131202542e281240b6cbf6f4ba8b31d30be61c72dc1a6fb81dd72
@@ -10,7 +10,7 @@ module Dry
10
10
  #
11
11
  # @return [#call(Dry::Types::Type)]
12
12
  def to_default
13
- ->(type) { type[call] }.freeze
13
+ -> type { type[call] }.freeze
14
14
  end
15
15
  end
16
16
 
@@ -20,7 +20,7 @@ module Dry
20
20
  #
21
21
  # @return [#call(Dry::Types::Type)]
22
22
  def to_default
23
- ->(type = Dry::Types["any"]) { type[self] }.to_default
23
+ -> type = Dry::Types["any"] { type[self] }.to_default
24
24
  end
25
25
  end
26
26
  end
@@ -12,7 +12,8 @@ module Dry
12
12
  in [] then raise ArgumentError, "[#{self}] has no attributes, one is required"
13
13
  in [key] then super({ key => value }, *other, &block)
14
14
  else
15
- raise ArgumentError, "[#{self}] has more than one attribute: #{attribute_names.join(', ')}"
15
+ raise ArgumentError,
16
+ "[#{self}] has more than one attribute: #{attribute_names.join(', ')}"
16
17
  end
17
18
  end
18
19
  end
data/lib/dry/concrete.rb CHANGED
@@ -30,17 +30,10 @@ module Dry
30
30
 
31
31
  config.order = Hash.new(-1)
32
32
 
33
- delegate(*%i[
34
- Constructor
35
- Interface
36
- Instance
37
- Constant
38
- Nominal
39
- Value
40
- Array
41
- Hash
42
- Any
43
- ], to: :Types)
33
+ delegate(
34
+ :Constructor, :Interface, :Instance, :Constant,
35
+ :Nominal, :Value, :Array, :Hash, :Any, to: :Types
36
+ )
44
37
 
45
38
  def self.initializer(owner, &block)
46
39
  owner.schema owner.schema.constructor(&block)
@@ -38,7 +38,8 @@ module Dry
38
38
  in [] then raise ArgumentError, "[#{self}] has no attributes, one is required"
39
39
  in [key] then _new({ key => value }, *other, &block)
40
40
  else
41
- raise ArgumentError, "[#{self}] has more than one attribute: #{attribute_names.join(', ')}"
41
+ raise ArgumentError,
42
+ "[#{self}] has more than one attribute: #{attribute_names.join(', ')}"
42
43
  end
43
44
  end
44
45
  end
data/lib/dry/interface.rb CHANGED
@@ -43,7 +43,7 @@ module Dry
43
43
 
44
44
  # @return [String]
45
45
  def self.to_s
46
- format("%<name>s<[%<types>s]>", name: name, types: subtypes.map(&:to_s).join(" | "))
46
+ "%s<[%s]>" % [name, subtypes.map(&:to_s).join(" | ")]
47
47
  end
48
48
 
49
49
  def self.reduce(input, subtype)
@@ -65,7 +65,7 @@ module Dry
65
65
  # @return [Dry::Struct::Sum, Dry::Struct::Class]
66
66
  def self.subtype
67
67
  Constructor(self) do |value, _type, &error|
68
- error ||= lambda do |error|
68
+ error ||= -> error do
69
69
  raise error
70
70
  end
71
71
 
data/lib/dry/value.rb CHANGED
@@ -13,7 +13,8 @@ module Dry
13
13
  in [] then raise ArgumentError, "[#{self}] has no attributes, one is required"
14
14
  in [key] then super({ key => value }, *other, &block)
15
15
  else
16
- raise ArgumentError, "[#{self}] has more than one attribute: #{attribute_names.join(', ')}"
16
+ raise ArgumentError,
17
+ "[#{self}] has more than one attribute: #{attribute_names.join(', ')}"
17
18
  end
18
19
  end
19
20
  end
data/lib/dry.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dry
2
4
  autoload :Value, "dry/value"
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-interface
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Linus Oleander
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-30 00:00:00.000000000 Z
11
+ date: 2021-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -86,14 +86,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 3.0.0
89
+ version: '2.7'
90
90
  required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []
96
- rubygems_version: 3.2.22
96
+ rubygems_version: 3.1.2
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Dry::Interface