might 0.7.5 → 0.7.6

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: f869b4b6ee90b6e24eb8cc2536525a038cff9d26d921a9f9f94c93d24a971249
4
- data.tar.gz: 2fbed37817a64752e22bb725d365408c7e8355d111a4ee60954cecbe9e237a43
3
+ metadata.gz: 8be852d8aedf6a83afcc182c335f0c86ebefc45c160bc51f971be97a48e0f60b
4
+ data.tar.gz: f93ca06adca45d09f07650f7bbd64e8a591006bce298133b44a829620a519276
5
5
  SHA512:
6
- metadata.gz: 3f8b92843b3c52236ac5052c38105cdeeb0045d5b007a11958f985511a8d6abd5434c2755bfbd709ac912e9aa55fc3d0097e9d8d3806af89ddc3e27e01b45c94
7
- data.tar.gz: 4d62a98391fbeb6ac6d04ab0a158847f9b988f6a39c50b5236bcf59dc0a53e705991fac0a91198ea9e738d7bebd429acdd2de7df633f0aa0a92874b4c440b4c2
6
+ metadata.gz: 812bd7ad2365800528bd3f7c197988d0148923694cf59bfc628c27f1878f4820e148da674afd6069ca080d2f648c26aa84d5454c7ea7cc061d03fdbb169d2865
7
+ data.tar.gz: 5569a65ece876bdfeeadd3c08b94941f7e4a7ecb16b8ce7140c683dc5a3cc95e5f5d8033d76dd2dc5c4c1c54c812e845e2da86f5a34a724a0df5f7f21abd6726
@@ -29,21 +29,25 @@ module Might
29
29
 
30
30
  # Find filter by name
31
31
  # @param name [String]
32
+ # @param predicate [String]
32
33
  # @return [Might::FilterParameter, nil]
33
34
  #
34
- def [](name)
35
- parameters.detect { |filter| filter.name == name }
35
+ def [](name, predicate = nil)
36
+ parameters.detect do |filter|
37
+ filter.name == name && (predicate.nil? || filter.predicate == predicate)
38
+ end
36
39
  end
37
40
 
38
41
  # Find filter by name or raise error
39
42
  # @param name [String]
43
+ # @param predicate [String]
40
44
  # @yieldparam name [String]
41
45
  # block value will be returned if no `FilterParameter` found with specified name
42
46
  # @return [Might::FilterParameter]
43
47
  # @raise FilterError
44
48
  #
45
- def fetch(name)
46
- if (filter = self[name])
49
+ def fetch(name, predicate = nil)
50
+ if (filter = self[name, predicate])
47
51
  filter
48
52
  elsif block_given?
49
53
  yield(name)
@@ -73,11 +77,12 @@ module Might
73
77
  self.class.new(parameters.merge(other.parameters))
74
78
  end
75
79
 
76
- # Delete filter by name
80
+ # Delete filter by name and predicate
77
81
  # @param name [String]
82
+ # @param predicate [String]
78
83
  # @return [Might::FilterParameter, nil]
79
- def delete(name)
80
- filter_parameter = self[name]
84
+ def delete(name, predicate = nil)
85
+ filter_parameter = self[name, predicate]
81
86
  parameters.delete(filter_parameter) if filter_parameter
82
87
  filter_parameter
83
88
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Might
3
- VERSION = '0.7.5'
3
+ VERSION = '0.7.6'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: might
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tema Bolshakov
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-18 00:00:00.000000000 Z
11
+ date: 2020-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -258,7 +258,7 @@ homepage: https://github.com/SPBTV/might
258
258
  licenses:
259
259
  - Apache 2.0
260
260
  metadata: {}
261
- post_install_message:
261
+ post_install_message:
262
262
  rdoc_options: []
263
263
  require_paths:
264
264
  - lib
@@ -273,9 +273,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
273
  - !ruby/object:Gem::Version
274
274
  version: '0'
275
275
  requirements: []
276
- rubyforge_project:
277
- rubygems_version: 2.7.6
278
- signing_key:
276
+ rubygems_version: 3.0.3
277
+ signing_key:
279
278
  specification_version: 4
280
279
  summary: Mighty resource fetchers
281
280
  test_files: []