friendly_routes 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -4
- data/lib/friendly_routes/helper.rb +2 -2
- data/lib/friendly_routes/services/parser.rb +3 -2
- data/lib/friendly_routes/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8439e8f83f46bc6afa81094830f641fa9ea7cca7
|
4
|
+
data.tar.gz: ad9afb0195a685c8ce086be2907081ffe9d94700
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20d13b6e78e836d318ae0af603320bc07f964196314b72f5ef455ac799d5bca1386ae7794a50724a8a36488b71fb44dc690c2f98a60b5aa7bf459082d522e5ce
|
7
|
+
data.tar.gz: d2edd292516c2f62db5b01da3b0d07fd376fb7a3a3e54dea3289ee913292bb9f496b470a716bad212460e624fcd43482b4b3241e179cc317ef3acdbf46fa9286
|
data/README.md
CHANGED
@@ -29,13 +29,11 @@ $ gem install friendly_routes
|
|
29
29
|
free = FriendlyRoutes::Params::BooleanParams.new(:free, true: :free, false: :paid)
|
30
30
|
category = FriendlyRoutes::Params::CollectionParams.new(:category_id, Category, :title)
|
31
31
|
|
32
|
-
dummies_route = FriendlyRoutes::Route.new(
|
33
|
-
dummies_route.params = [free, category]
|
32
|
+
dummies_route = FriendlyRoutes::Route.new([free, category], controller: :dummies, action: :index)
|
34
33
|
|
35
34
|
friendly_url_for dummies_route, :get # '/:free/:category'
|
36
35
|
|
37
|
-
second_dummies_route = FriendlyRoutes::Route.new(controller: :dummies, action: :index)
|
38
|
-
dummies_route.params = [free, 'categories', category]
|
36
|
+
second_dummies_route = FriendlyRoutes::Route.new([free, 'categories', category], controller: :dummies, action: :index)
|
39
37
|
|
40
38
|
friendly_url_for dummies_route, :get, '/' # '/:free/categories/:category'
|
41
39
|
friendly_url_for dummies_route, :get, '/hello/' # '/hello/:free/categories/:category'
|
@@ -2,8 +2,9 @@
|
|
2
2
|
|
3
3
|
module FriendlyRoutes
|
4
4
|
class Parser
|
5
|
-
def initialize(params)
|
5
|
+
def initialize(params, keep_all)
|
6
6
|
@params = params
|
7
|
+
@keep_all = keep_all
|
7
8
|
@route = @params[:friendly_route]
|
8
9
|
end
|
9
10
|
|
@@ -21,7 +22,7 @@ module FriendlyRoutes
|
|
21
22
|
value = @params[prefixed_name]
|
22
23
|
return unless value
|
23
24
|
@params[param.name] = param.parse(value)
|
24
|
-
@params.delete(prefixed_name) unless param.name == prefixed_name
|
25
|
+
@params.delete(prefixed_name) unless @keep_all || param.name == prefixed_name
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: friendly_routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Gritsay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|