action_interceptor 1.0.0 → 1.1.0

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: ce38ce707a8334bb66b8acf906521d3b3767d4b8
4
- data.tar.gz: 27684b0414dbd5d8c7b7e1eeb89c7595afaa8c94
3
+ metadata.gz: 9407178e3d4a8be9957a5eacd4df9ee9f0866dc6
4
+ data.tar.gz: da347d252ab6462a8c29ffdc3c50ba9628fc672a
5
5
  SHA512:
6
- metadata.gz: 77ae4ca36711165371f3001101bf52e6f2cb3710bdcbaf17f2d48ee7c210c0f2130fb19e0ec8478cfebac4f73e01f173d66338e1cf296775c5c10c13119c99e3
7
- data.tar.gz: 489a4126575dd1928b1840b420b38896e55e5a6de05403de093115657d6385ec290f8a4ad8318239c0361208dd781a13ca9683966af3396c2eb7391162a08010
6
+ metadata.gz: 3eb6db687c0d53268e0abc9d7e4199291373297c51b70edbe10f54c9bfdab651749f6f3c672bd44a88cf73bc301f10349a5d8f5dcc3270c162e1cc80fb724a75
7
+ data.tar.gz: d8058e0e5039eb228e1165cd7ada869fd0442673ab690a36e5d728e45633d110907a93ad31d25c4e4c1e8b93282e8d2fc9111cb2b8468cae7d7802bf7935b963
@@ -25,24 +25,22 @@ module ActionInterceptor
25
25
  end
26
26
 
27
27
  # Stores the given url or the current url
28
+ # If the current request is not a GET request, stores the referer instead
28
29
  def store_url(options = {})
29
- strats = ActionInterceptor::Strategies.find_all(self,
30
- options[:strategies])
30
+ strats = ActionInterceptor::Strategies.find_all(self, options[:strategies])
31
31
  key = options[:key] || ActionInterceptor.config.default_key
32
32
 
33
- url = options.has_key?(:url) ? options[:url] : current_url
33
+ url = options.has_key?(:url) ?
34
+ options[:url] : (request.get? ? current_url : request.referer)
34
35
 
35
- strats.each do |strat|
36
- strat.set(key, url)
37
- end
36
+ strats.each{ |strat| strat.set(key, url) }
38
37
 
39
38
  url
40
39
  end
41
40
 
42
41
  # Retrieves the stored url
43
42
  def stored_url(options = {})
44
- strats = ActionInterceptor::Strategies.find_all(self,
45
- options[:strategies])
43
+ strats = ActionInterceptor::Strategies.find_all(self, options[:strategies])
46
44
  key = options[:key] || ActionInterceptor.config.default_key
47
45
 
48
46
  strats.each do |strat|
@@ -61,8 +59,7 @@ module ActionInterceptor
61
59
 
62
60
  # Deletes to the stored url
63
61
  def delete_stored_url(options = {})
64
- strats = ActionInterceptor::Strategies.find_all(self,
65
- options[:strategies])
62
+ strats = ActionInterceptor::Strategies.find_all(self, options[:strategies])
66
63
  key = options[:key] || ActionInterceptor.config.default_key
67
64
 
68
65
  strats.each do |strat|
@@ -81,8 +78,7 @@ module ActionInterceptor
81
78
  delete_stored_url(interceptor_options)
82
79
 
83
80
  # Prevent self redirects
84
- url = (ActionInterceptor.config.default_url || main_app.root_url) \
85
- if current_page?(url)
81
+ url = (ActionInterceptor.config.default_url || main_app.root_url) if current_page?(url)
86
82
 
87
83
  redirect_to url, redirect_options
88
84
  end
@@ -24,5 +24,4 @@ module ActionInterceptor
24
24
  end
25
25
  end
26
26
 
27
- ActionInterceptor::Strategies.register(:session,
28
- ActionInterceptor::Strategies::Session)
27
+ ActionInterceptor::Strategies.register(:session, ActionInterceptor::Strategies::Session)
@@ -1,3 +1,3 @@
1
1
  module ActionInterceptor
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_interceptor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dante Soares
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-19 00:00:00.000000000 Z
11
+ date: 2016-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.4.6
138
+ rubygems_version: 2.4.5.1
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Handles storage of return url's across multiple requests