might 0.4.0 → 0.5.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: ae3926df5c33265477c17c0e4a6fdf51bbce9be3
4
- data.tar.gz: c83a4f1777d278ff57c90413eb83f4594e48ff4c
3
+ metadata.gz: 2050feff383533125774a05a3de740e55ffd6fc5
4
+ data.tar.gz: a7a70f53d00d24ff06b4110d016a2c35edd677a6
5
5
  SHA512:
6
- metadata.gz: dc69eca7bb795d151954266c0983c524ad8be4d91402bd6a51632073dfea34b0d82be496870e114c3344149dbab105118ed8f68aab72dadc34dc57628be1c8f0
7
- data.tar.gz: 6fa421771cab463f19a275a982a137b5b928148499bd5fc45612660bc713d3d9bc524a22ea94e76e19947b5bdb4cdf5e5f40a1c51d176358d20c317ecdb103aa
6
+ metadata.gz: 5e6302efe3d97007443100a2ed6b6887b9f778950ca83ff0584bccc2892ab5d8fceb5d9fbcca119f639d397dfb1cd68f43b0598c4475566df6dd49ee20f1b7bf
7
+ data.tar.gz: 66fada3e80be4d3bd5c350e7d4a8f9b01c26dd0a899f3f4fe5b91018a93c8b6d6e57a6a6edae58f62e35a9de7d42831ead615f3da4c3c511e08b1f7782167fb4
@@ -1,13 +1,5 @@
1
- # Configuration parameters: AllowURI, URISchemes.
2
- Metrics/LineLength:
3
- Max: 120
4
-
5
- Metrics/AbcSize:
6
- Severity: refactor
7
-
8
- # Configuration parameters: CountComments.
9
- Metrics/MethodLength:
10
- Severity: refactor
1
+ inherit_gem:
2
+ spbtv_code_style: .rubocop.yml
11
3
 
12
4
  Style/AccessorMethodName:
13
5
  Exclude:
@@ -1,3 +1,7 @@
1
+ **0.5.0**
2
+
3
+ * Introduce Might::FilterParameters as subclass of Setq
4
+
1
5
  **0.4.0**
2
6
 
3
7
  * Got rid off `#pagination` method on paginated collection.
@@ -1,3 +1,4 @@
1
+ require 'might/filter_parameters'
1
2
  require 'might/sort_parameters_extractor'
2
3
  require 'might/sort_parameters_validator'
3
4
  require 'might/filter_parameters_extractor'
@@ -58,7 +59,7 @@ module Might
58
59
  inheritable_attr :sort_parameters_definition
59
60
  inheritable_attr :middleware_changes
60
61
 
61
- self.filter_parameters_definition = Set.new
62
+ self.filter_parameters_definition = FilterParameters.new
62
63
  self.sort_parameters_definition = Set.new
63
64
  self.middleware_changes = []
64
65
 
@@ -0,0 +1,29 @@
1
+ require 'set'
2
+
3
+ module Might
4
+ #
5
+ class FilterParameters < Set
6
+ FilterError = Class.new(KeyError)
7
+
8
+ # Find filter by name
9
+ # @param name [String]
10
+ # @return [Might::FilterParameter, nil]
11
+ #
12
+ def [](name)
13
+ detect { |filter| filter.name == name }
14
+ end
15
+
16
+ # Find filter by name or raise error
17
+ # @param name [String]
18
+ # @return [Might::FilterParameter]
19
+ # @raise FilterError
20
+ #
21
+ def fetch(name)
22
+ if (filter = self[name])
23
+ filter
24
+ else
25
+ fail FilterError, "filter not found: #{name.inspect}"
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,4 +1,4 @@
1
1
  #
2
2
  module Might
3
- VERSION = '0.4.0'
3
+ VERSION = '0.5.0'
4
4
  end
@@ -29,5 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency 'bundler', '~> 1.10'
30
30
  spec.add_development_dependency 'rake', '~> 10.0'
31
31
  spec.add_development_dependency 'rspec', '~> 3.3'
32
- spec.add_development_dependency 'rubocop', '~> 0.34.2'
32
+ spec.add_development_dependency 'spbtv_code_style'
33
33
  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.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tema Bolshakov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-14 00:00:00.000000000 Z
11
+ date: 2015-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -151,19 +151,19 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '3.3'
153
153
  - !ruby/object:Gem::Dependency
154
- name: rubocop
154
+ name: spbtv_code_style
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "~>"
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: 0.34.2
159
+ version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "~>"
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: 0.34.2
166
+ version: '0'
167
167
  description: Mighty resource fetchers build on top of Ransack gem
168
168
  email:
169
169
  - abolshakov@spbtv.com
@@ -176,7 +176,7 @@ files:
176
176
  - ".rspec"
177
177
  - ".rubocop.yml"
178
178
  - ".travis.yml"
179
- - CHANGES.md
179
+ - CHANGELOG.md
180
180
  - Gemfile
181
181
  - LICENSE
182
182
  - README.md
@@ -190,6 +190,7 @@ files:
190
190
  - lib/might/filter_middleware.rb
191
191
  - lib/might/filter_parameter.rb
192
192
  - lib/might/filter_parameter_definition.rb
193
+ - lib/might/filter_parameters.rb
193
194
  - lib/might/filter_parameters_extractor.rb
194
195
  - lib/might/filter_parameters_validator.rb
195
196
  - lib/might/filter_predicates.rb
@@ -233,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
234
  version: '0'
234
235
  requirements: []
235
236
  rubyforge_project:
236
- rubygems_version: 2.4.8
237
+ rubygems_version: 2.4.5.1
237
238
  signing_key:
238
239
  specification_version: 4
239
240
  summary: Mighty resource fetchers