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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b41c57c0c6f008e93b285d2155b9935b40ae944
4
- data.tar.gz: 3c94897029301dc6a4bb7714c63aaef281738456
3
+ metadata.gz: 8439e8f83f46bc6afa81094830f641fa9ea7cca7
4
+ data.tar.gz: ad9afb0195a685c8ce086be2907081ffe9d94700
5
5
  SHA512:
6
- metadata.gz: aef2af7a72e8cceda3cec4acf3f5f61777f1d3ac38a0c5bb9b45dcfb3583e953c57930858ba870657eeda23d19665b52e3bb99d568de3ae68eb11f2a828f7949
7
- data.tar.gz: c453204219e880474f4359556a07c917ece94d6decf0a0927d53d71ef3052ffc58e92c25d0a25b09024d30784c0652002ea17fd4fef526050312efd684010f6a
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('/', controller: :dummies, action: :index)
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,8 @@
2
2
 
3
3
  module FriendlyRoutes
4
4
  module Helper
5
- def parse_friendly_routes
6
- FriendlyRoutes::Parser.new(params).call
5
+ def parse_friendly_routes(keep_all: false)
6
+ FriendlyRoutes::Parser.new(params, keep_all).call
7
7
  end
8
8
  end
9
9
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FriendlyRoutes
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.2'
5
5
  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.1
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-06 00:00:00.000000000 Z
11
+ date: 2016-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails