strelka 0.0.1.pre.253 → 0.0.1.pre.254
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/lib/strelka/session/db.rb +32 -32
- data/lib/strelka/session/default.rb +22 -22
- metadata +1 -1
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/strelka/session/db.rb
CHANGED
@@ -62,38 +62,6 @@ class Strelka::Session::Db < Strelka::Session::Default
|
|
62
62
|
### C L A S S M E T H O D S
|
63
63
|
########################################################################
|
64
64
|
|
65
|
-
### Configure the session class with the given +options+, which should be a
|
66
|
-
### Hash or an object that has a Hash-like interface.
|
67
|
-
###
|
68
|
-
### Valid options (in addition to those ):
|
69
|
-
###
|
70
|
-
### [cookie_name]::
|
71
|
-
### The name of the cookie to use for the session ID
|
72
|
-
### [cookie_options]::
|
73
|
-
### Options to pass to Strelka::Cookie's constructor.
|
74
|
-
### [connect]::
|
75
|
-
### The Sequel connection string; if nil, an in-memory DB will be used.
|
76
|
-
### [table_name]::
|
77
|
-
### The name of the sessions table. Defaults to 'sessions'.
|
78
|
-
def self::configure( options=nil )
|
79
|
-
super
|
80
|
-
|
81
|
-
if options
|
82
|
-
self.table_name = options[:table_name]
|
83
|
-
self.db = options[ :connect ].nil? ?
|
84
|
-
Mongrel2::Config.in_memory_db :
|
85
|
-
Sequel.connect( options[:connect] )
|
86
|
-
else
|
87
|
-
self.table_name = CONFIG_DEFAULTS[:table_name]
|
88
|
-
self.db = Mongrel2::Config.in_memory_db
|
89
|
-
end
|
90
|
-
|
91
|
-
self.db.logger = Loggability[ Mongrel2 ].proxy_for( self.db )
|
92
|
-
self.db.sql_log_level = :debug
|
93
|
-
self.initialize_sessions_table
|
94
|
-
end
|
95
|
-
|
96
|
-
|
97
65
|
### Create the initial DB sessions schema if needed, setting the +sessions+
|
98
66
|
### attribute to a Sequel dataset on the configured DB table.
|
99
67
|
###
|
@@ -150,5 +118,37 @@ class Strelka::Session::Db < Strelka::Session::Default
|
|
150
118
|
return !self.dataset.filter( :session_id => id ).empty?
|
151
119
|
end
|
152
120
|
|
121
|
+
### Configure the session class with the given +options+, which should be a
|
122
|
+
### Hash or an object that has a Hash-like interface.
|
123
|
+
###
|
124
|
+
### Valid options (in addition to those ):
|
125
|
+
###
|
126
|
+
### [cookie_name]::
|
127
|
+
### The name of the cookie to use for the session ID
|
128
|
+
### [cookie_options]::
|
129
|
+
### Options to pass to Strelka::Cookie's constructor.
|
130
|
+
### [connect]::
|
131
|
+
### The Sequel connection string; if nil, an in-memory DB will be used.
|
132
|
+
### [table_name]::
|
133
|
+
### The name of the sessions table. Defaults to 'sessions'.
|
134
|
+
def self::configure( options=nil )
|
135
|
+
super
|
136
|
+
|
137
|
+
if options
|
138
|
+
self.table_name = options[:table_name]
|
139
|
+
self.db = options[ :connect ].nil? ?
|
140
|
+
Mongrel2::Config.in_memory_db :
|
141
|
+
Sequel.connect( options[:connect] )
|
142
|
+
else
|
143
|
+
self.table_name = CONFIG_DEFAULTS[:table_name]
|
144
|
+
self.db = Mongrel2::Config.in_memory_db
|
145
|
+
end
|
146
|
+
|
147
|
+
self.db.logger = Loggability[ Mongrel2 ].proxy_for( self.db )
|
148
|
+
self.db.sql_log_level = :debug
|
149
|
+
self.initialize_sessions_table
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
153
|
end # class Strelka::Session::Db
|
154
154
|
|
@@ -52,28 +52,6 @@ class Strelka::Session::Default < Strelka::Session
|
|
52
52
|
singleton_attr_accessor :cookie_options
|
53
53
|
|
54
54
|
|
55
|
-
### Configure the session class with the given +options+, which should be a
|
56
|
-
### Hash or an object that has a Hash-like interface.
|
57
|
-
###
|
58
|
-
### Valid keys:
|
59
|
-
###
|
60
|
-
### [\cookie_name]
|
61
|
-
### The name of the cookie that will be used for persisting the session key.
|
62
|
-
### [\cookie_options]
|
63
|
-
### A hash of options for the session cookie; see
|
64
|
-
### {Strelka::Cookie}[rdoc-ref://Strelka::Cookie.new]
|
65
|
-
### for available options.
|
66
|
-
def self::configure( config=nil )
|
67
|
-
if config
|
68
|
-
self.cookie_name = config[:cookie_name]
|
69
|
-
self.cookie_options = config[:cookie_options]
|
70
|
-
else
|
71
|
-
self.cookie_name = CONFIG_DEFAULTS[:cookie_name]
|
72
|
-
self.cookie_options = CONFIG_DEFAULTS[:cookie_options].dup
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
55
|
### Load a session instance from storage using the given +session_id+ and return
|
78
56
|
### it. Returns +nil+ if no session could be loaded.
|
79
57
|
def self::load_session_data( session_id )
|
@@ -125,6 +103,28 @@ class Strelka::Session::Default < Strelka::Session
|
|
125
103
|
end
|
126
104
|
|
127
105
|
|
106
|
+
### Configure the session class with the given +options+, which should be a
|
107
|
+
### Hash or an object that has a Hash-like interface.
|
108
|
+
###
|
109
|
+
### Valid keys:
|
110
|
+
###
|
111
|
+
### [\cookie_name]
|
112
|
+
### The name of the cookie that will be used for persisting the session key.
|
113
|
+
### [\cookie_options]
|
114
|
+
### A hash of options for the session cookie; see
|
115
|
+
### {Strelka::Cookie}[rdoc-ref://Strelka::Cookie.new]
|
116
|
+
### for available options.
|
117
|
+
def self::configure( config=nil )
|
118
|
+
if config
|
119
|
+
self.cookie_name = config[:cookie_name]
|
120
|
+
self.cookie_options = config[:cookie_options]
|
121
|
+
else
|
122
|
+
self.cookie_name = CONFIG_DEFAULTS[:cookie_name]
|
123
|
+
self.cookie_options = CONFIG_DEFAULTS[:cookie_options].dup
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
128
|
#################################################################
|
129
129
|
### I N S T A N C E M E T H O D S
|
130
130
|
#################################################################
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|