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 +4 -4
- data/.rubocop.yml +2 -10
- data/{CHANGES.md → CHANGELOG.md} +4 -0
- data/lib/might/fetcher.rb +2 -1
- data/lib/might/filter_parameters.rb +29 -0
- data/lib/might/version.rb +1 -1
- data/might.gemspec +1 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2050feff383533125774a05a3de740e55ffd6fc5
|
4
|
+
data.tar.gz: a7a70f53d00d24ff06b4110d016a2c35edd677a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e6302efe3d97007443100a2ed6b6887b9f778950ca83ff0584bccc2892ab5d8fceb5d9fbcca119f639d397dfb1cd68f43b0598c4475566df6dd49ee20f1b7bf
|
7
|
+
data.tar.gz: 66fada3e80be4d3bd5c350e7d4a8f9b01c26dd0a899f3f4fe5b91018a93c8b6d6e57a6a6edae58f62e35a9de7d42831ead615f3da4c3c511e08b1f7782167fb4
|
data/.rubocop.yml
CHANGED
@@ -1,13 +1,5 @@
|
|
1
|
-
|
2
|
-
|
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:
|
data/{CHANGES.md → CHANGELOG.md}
RENAMED
data/lib/might/fetcher.rb
CHANGED
@@ -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 =
|
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
|
data/lib/might/version.rb
CHANGED
data/might.gemspec
CHANGED
@@ -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 '
|
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
|
+
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-
|
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:
|
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
|
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
|
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
|
-
-
|
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.
|
237
|
+
rubygems_version: 2.4.5.1
|
237
238
|
signing_key:
|
238
239
|
specification_version: 4
|
239
240
|
summary: Mighty resource fetchers
|