sinatra-routing-helpers 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a0521881bcc5df3252574c3836ea89b624fb3d9
4
- data.tar.gz: e467ca4d923c209f535b9bae83ba2250cacc9a05
3
+ metadata.gz: e46c11758ebad36061289f254ce8f5071e94f964
4
+ data.tar.gz: fbd9a026b9204a8c09d2affb45a772bcd8d4d0b5
5
5
  SHA512:
6
- metadata.gz: d2f89b2bc16912160173f3e7099e2057eca0a0f7117baecd7abb65d1359fa9e061288f3003b2db768ed29594f9866a7092627b7a42cb0968128767ebce0b0ed6
7
- data.tar.gz: d00a48a670e49859fe35f336f6a37710cbb58ac7a453f58fed5ec4876825abbda29dc83fc9dde883cee84c3d9025e31da3aee2f2d38871121c6c4c8b761ee887
6
+ metadata.gz: d2c427c70f46db88fc6cf1617011227afb4fba5faf07a9bd569beccb9cb84ed233a726463789e3c49b32c3b3f8268d297aa2f207cbb2ceb34b013e969a8d28e6
7
+ data.tar.gz: abd3755040deb9708bec49c01f1a1abe42c66907226a20789c81ae35fc46fa27b69383e5557730efa5ac3cbb035dc9531bda3d549992a6ad2b24e319f6b87d43
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module RoutingHelpers
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
@@ -8,14 +8,16 @@ module Sinatra
8
8
  module HelperMethods
9
9
  include Rack::Utils
10
10
 
11
- # better handling of referrer path
12
- def parsed_referrer_path
13
- if (!request.referrer.nil? && !request.referrer.empty?) && parsed_referrer = URI.parse(request.referrer)
14
- if parsed_referrer.path.end_with?('/')
15
- parsed_referrer.path.chop!
11
+ # better handling of referer path
12
+ def parsed_referer_path
13
+ rf = request.referer
14
+
15
+ if (!rf.nil? && !rf.empty?) && parsed_referer = URI.parse(rf)
16
+ if parsed_referer.path.end_with?('/')
17
+ parsed_referer.path.chop!
16
18
  end
17
19
 
18
- parsed_referrer.path
20
+ parsed_referer.path
19
21
  else
20
22
  nil
21
23
  end
@@ -25,12 +27,9 @@ module Sinatra
25
27
  def is_page?(route)
26
28
  path_info = request.path_info
27
29
 
28
- if route.class == String
29
- route == path_info
30
- elsif route.class == Array
31
- route.any? do |individual_route|
32
- path_info == individual_route
33
- end
30
+ case route
31
+ when String; route == path_info
32
+ when Array; route.include?(individual_route)
34
33
  else
35
34
  false
36
35
  end
@@ -61,7 +60,7 @@ module Sinatra
61
60
  # redirect to(back_with_params(my_extra_param: 'my extra value'))
62
61
  #
63
62
  def back_with_params(extra_params = {})
64
- back_to = parsed_referrer_path || '/'
63
+ back_to = parsed_referer_path || '/'
65
64
  clean_params = params.reject do |key, value|
66
65
  settings.params_blacklist.include?(key.to_sym)
67
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-routing-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Lecklider