sinatra-frank 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,28 @@
1
+ # Simple flash messaging in Sinatra
2
+ #
3
+ # require 'sinatra/flash_message'
4
+ #
5
+ # configure { enable :sessions }
6
+ # helpers { def flash; @flash ||= FlashMessage.new(session); end }
7
+ #
8
+ # get '/' do
9
+ # flash.message = 'hello world'
10
+ # end
11
+ #
12
+ # <%= flash.message %>
13
+ #
14
+ class FlashMessage
15
+ def initialize(session)
16
+ @session ||= session
17
+ end
18
+
19
+ def message=(message)
20
+ @session[:flash] = message
21
+ end
22
+
23
+ def message
24
+ message = @session[:flash]
25
+ @session[:flash] = nil
26
+ message
27
+ end
28
+ end
data/lib/sinatra/frank.rb CHANGED
@@ -54,6 +54,6 @@ module Sinatra
54
54
  end
55
55
  end
56
56
 
57
- helpers Frank::Helpers
58
- register Frank::HoneyPot
57
+ helpers Frank::Helpers
58
+ register Frank::HoneyPot
59
59
  end
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module Frank
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-frank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-18 00:00:00.000000000 Z
12
+ date: 2013-11-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -55,6 +55,7 @@ files:
55
55
  - LICENSE.txt
56
56
  - README.md
57
57
  - Rakefile
58
+ - lib/sinatra/flash_message.rb
58
59
  - lib/sinatra/frank.rb
59
60
  - lib/sinatra/frank/version.rb
60
61
  - sinatra-frank.gemspec