friendly_routes 0.4.5 → 0.4.6

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: 33314fce720e59eaf5e7e7fe8addbf08769aeec0
4
- data.tar.gz: 600a3772f17a2521b44013a4460fdde8a2f81d8a
3
+ metadata.gz: 270cb4d5ebbc534560258c054aa5a9e919dac8b0
4
+ data.tar.gz: 9605c2f025439483bbf9bc12f35760f47052e7cc
5
5
  SHA512:
6
- metadata.gz: 44d019c1bf741c1e3135d10478211cdf5b922139c24668d334faaff110513b1af233408144e4eaa6622e40753f413910150caa4954ad55469abd4cf8ca2373e3
7
- data.tar.gz: 21a5a7a23f8385fc1dfdab52fc8fc2f25e20f07b8177dcb72498dd66b6ed1704d51b7f6daef40019c274b52c3ba7d0821667cbd31dde3ee723abe874abb85ff4
6
+ metadata.gz: 22515c1fc10f0d2ec607306ae755ed1665d8e82acd592d40351a2c9f47d997853b9c3f284c56b651d6a72f4773c6e15cae974784f2e4d9ef5071bf9bf08e26b4
7
+ data.tar.gz: ba7ad4a6a9d9a8d854a83512a6f763e06c25b21594a0ca5a5da23f8c65a81c9a32fda6e60d00f1c10a2e87a16bda6688530f0e67b1ea94b4a746d7a8ff5bfe8c
@@ -49,6 +49,11 @@ module FriendlyRoutes
49
49
  def allowed?
50
50
  raise NotImplementedError
51
51
  end
52
+
53
+ # Inverse of {allowed?}
54
+ def refused?(*args)
55
+ !allowed?(*args)
56
+ end
52
57
  end
53
58
  end
54
59
  end
@@ -27,7 +27,7 @@ module FriendlyRoutes
27
27
 
28
28
  def compose(param)
29
29
  value = @params[param.name]
30
- return unless param.allowed?(value)
30
+ return if value.nil? || param.refused?(value)
31
31
  prefixed_name = FriendlyRoutes::PrefixedParam.new(param.name, @route.prefix).call
32
32
  @params[prefixed_name] = param.compose(value)
33
33
  @params.delete(param.name) unless param.name == prefixed_name
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FriendlyRoutes
4
- VERSION = '0.4.5'
4
+ VERSION = '0.4.6'
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.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Gritsay