friendly_routes 0.3.2 → 0.3.3

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: 8439e8f83f46bc6afa81094830f641fa9ea7cca7
4
- data.tar.gz: ad9afb0195a685c8ce086be2907081ffe9d94700
3
+ metadata.gz: 20f66faa1c0ee03ba5ee4d409c3533c233fce5a6
4
+ data.tar.gz: 86d56ad4c80db6eaefc1b72ebaabc543ac61f74e
5
5
  SHA512:
6
- metadata.gz: 20d13b6e78e836d318ae0af603320bc07f964196314b72f5ef455ac799d5bca1386ae7794a50724a8a36488b71fb44dc690c2f98a60b5aa7bf459082d522e5ce
7
- data.tar.gz: d2edd292516c2f62db5b01da3b0d07fd376fb7a3a3e54dea3289ee913292bb9f496b470a716bad212460e624fcd43482b4b3241e179cc317ef3acdbf46fa9286
6
+ metadata.gz: 587782afc11016d44dd17f9ed2b54e19e1f0c84ec99053ef6314473f1464460a5cfdba97f2c5839581f9815e4a0e26fcbe044e4e3e9ce010988289fba9497918
7
+ data.tar.gz: 45e249b6bd390058e8d3be82fe1b716c428ed064709554af10055b99a18819ee930841ee3d2d349e95d09a6c11f6b65635019b4d615f15e450bf93b03b554eb4
@@ -10,7 +10,7 @@ module FriendlyRoutes
10
10
  end
11
11
 
12
12
  def path
13
- FriendlyRoutes::PrefixedParams.new(@params, @prefix).call
13
+ FriendlyRoutes::PrefixedParams.new(@params, @prefix).to_s
14
14
  end
15
15
 
16
16
  def constraints
@@ -7,21 +7,33 @@ module FriendlyRoutes
7
7
  @prefix = prefix
8
8
  end
9
9
 
10
+ def to_s
11
+ mapped(true).join('/')
12
+ end
13
+
10
14
  def call
11
- mapped.join('/')
15
+ mapped(false)
12
16
  end
13
17
 
14
18
  private
15
19
 
16
- def mapped
20
+ def mapped(keys = true)
17
21
  @params.map do |param|
18
22
  if param.is_a?(FriendlyRoutes::Params::Base)
19
- name = PrefixedParam.new(param.name, @prefix).call
20
- param.optional? ? "(:#{name})" : ":#{name}"
23
+ param_name(param, keys)
21
24
  else
22
25
  param
23
26
  end
24
27
  end
25
28
  end
29
+
30
+ def param_name(param, key = true)
31
+ name = PrefixedParam.new(param.name, @prefix).call
32
+ if key
33
+ param.optional? ? "(:#{name})" : ":#{name}"
34
+ else
35
+ name
36
+ end
37
+ end
26
38
  end
27
39
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FriendlyRoutes
4
- VERSION = '0.3.2'
4
+ VERSION = '0.3.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: friendly_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Gritsay