summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/zorglub.rb1
-rw-r--r--lib/zorglub/node.rb3
-rw-r--r--lib/zorglub/session.rb20
3 files changed, 23 insertions, 1 deletions
diff --git a/lib/zorglub.rb b/lib/zorglub.rb
index 9adda5d..62aa10c 100644
--- a/lib/zorglub.rb
+++ b/lib/zorglub.rb
@@ -9,6 +9,7 @@ module Zorglub
autoload :Config, './lib/zorglub/config.rb'
autoload :Helpers, './lib/zorglub/helpers.rb'
autoload :Node, './lib/zorglub/node.rb'
+ autoload :Session, './lib/zorglub/session.rb'
#
end
#
diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb
index b4f7e62..2e080ca 100644
--- a/lib/zorglub/node.rb
+++ b/lib/zorglub/node.rb
@@ -30,7 +30,8 @@ module Zorglub
def call env
meth, *args = env['PATH_INFO'][1..-1].split '/'
meth||= 'index'
- node = self.new Rack::Request.new(env), Rack::Response.new, {:engine=>engine,:layout=>layout,:view=>File.join(r,meth),:method=>meth,:args=>args}
+ action = {:engine=>engine,:layout=>layout,:view=>File.join(r,meth),:method=>meth,:args=>args}
+ node = self.new Rack::Request.new(env), Rack::Response.new, action
return error_404 node if not node.respond_to? meth
# TODO
# - session
diff --git a/lib/zorglub/session.rb b/lib/zorglub/session.rb
new file mode 100644
index 0000000..b119e2b
--- /dev/null
+++ b/lib/zorglub/session.rb
@@ -0,0 +1,20 @@
+# -*- coding: UTF-8 -*-
+#
+require 'securerandom'
+#
+module Zorglub
+ #
+ Config.session_id_length ||= 64
+ Config.session_ttl ||= (60 * 60 * 24 * 5)
+ #
+ class Session
+ #
+ def gen_session_id
+ SecureRandom.hex Config.session_id_length
+ end
+ #
+ end
+ #
+end
+#
+# EOF