summaryrefslogtreecommitdiffstats
path: root/example/sample.ru
diff options
context:
space:
mode:
Diffstat (limited to 'example/sample.ru')
-rw-r--r--example/sample.ru35
1 files changed, 18 insertions, 17 deletions
diff --git a/example/sample.ru b/example/sample.ru
index 063680f..45614f6 100644
--- a/example/sample.ru
+++ b/example/sample.ru
@@ -95,21 +95,22 @@ class Node3 < Zorglub::Node
#
def index *args
@title = "Session tests"
- if not session.exists?
- @data = "NO SESSION"
+ t = Time.now
+ @sid = session.sid
+ if session[:now].nil?
+ session[:now] = t
+ @data = "#{t.strftime('%H:%M:%S')} FIRST"
+ elsif t-session[:now]>10
+ session[:now] = t
+ @data = "#{t.strftime('%H:%M:%S')} UPDATE"
else
- t = Time.now
- if session[:now].nil?
- session[:now] = t
- @data = "#{t.strftime('%H:%M:%S')} FIRST"
- elsif t-session[:now]>5
- session[:now] = t
- @data = "#{t.strftime('%H:%M:%S')} UPDATE"
- else
- @data = "#{session[:now].strftime('%H:%M:%S')} CURRENT"
- end
+ @data = "#{session[:now].strftime('%H:%M:%S')} CURRENT"
end
end
+ def reset
+ session.destroy!
+ redirect :index
+ end
#
end
# #
@@ -145,11 +146,11 @@ puts APP.to_hash.inspect
map '/' do
use Rack::Lint
use Rack::ShowExceptions
- use Rack::Session::Cookie, :key=>Zorglub::Session.session_key,
- :secret=>'my-secret-secret',
- :path=>'/',
- :http_only=>true,
- :expire_after=>30
+# use Rack::Session::Cookie, :key=>Zorglub::Session.key,
+# :secret=>'my-secret-secret',
+# :path=>'/',
+# :http_only=>true,
+# :expire_after=>30
run APP
end
#