padrino-contrib 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of padrino-contrib might be problematic. Click here for more details.
- data/lib/padrino-contrib/flash_session.rb +16 -14
- data/lib/padrino-contrib/version.rb +1 -1
- metadata +3 -3
@@ -11,27 +11,29 @@ module Padrino
|
|
11
11
|
#
|
12
12
|
# ==== Usage
|
13
13
|
#
|
14
|
-
#
|
14
|
+
# register Padrino::Contrib::FlashSession
|
15
15
|
#
|
16
|
-
|
16
|
+
module FlashSession
|
17
17
|
|
18
18
|
def self.registered(app)
|
19
|
-
app.use Padrino::Contrib::FlashSession, app.session_id
|
19
|
+
app.use Padrino::Contrib::FlashSession::Middleware, app.session_id
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
module Middleware
|
23
|
+
def initialize(app, session_key = 'session_id')
|
24
|
+
@app = app
|
25
|
+
@session_key = session_key.to_s
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
def call(env)
|
29
|
+
if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
|
30
|
+
params = ::Rack::Request.new(env).params
|
31
|
+
env['rack.session'] ||= {}
|
32
|
+
env['rack.session'][@session_key.to_sym] = params[@session_key] if params[@session_key].present?
|
33
|
+
end
|
34
|
+
@app.call(env)
|
32
35
|
end
|
33
|
-
|
34
|
-
end
|
36
|
+
end # Middleware
|
35
37
|
end # FlashSession
|
36
38
|
end # Contrib
|
37
39
|
end # Padrino
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 8
|
10
|
+
version: 0.1.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Davide D'Agostino
|