mongo_sessions 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,8 +16,16 @@ And change config/application.rb to something like:
16
16
 
17
17
  = When Using in Rack Applications
18
18
 
19
- Require the rack mongo store and add the Rack Middleware to your app:
19
+ Add the gem to your Gemfile:
20
20
 
21
+ gem "mongo_sessions", :require => "mongo_sessions/rack_mongo_store"
22
+
23
+ If you are not using Bundler.require:
24
+
25
+ require "mongo_sessions/rack_mongo_store"
26
+
27
+ Add the Rack Middleware to your app:
28
+
21
29
  use Rack::Session::MongoStore
22
30
 
23
31
  == Note on Patches/Pull Requests
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.3.5
@@ -6,27 +6,31 @@ module MongoSessions
6
6
  def collection
7
7
  @collection
8
8
  end
9
-
9
+
10
10
  def initialize(app, options = {})
11
11
  require 'mongo'
12
-
12
+
13
13
  unless options[:collection]
14
14
  raise "To avoid creating multiple connections to MongoDB, " +
15
15
  "the Mongo Session Store will not create it's own connection " +
16
16
  "to MongoDB - you must pass in a collection with the :collection option"
17
17
  end
18
-
18
+
19
19
  @collection = options[:collection].respond_to?(:call) ? options[:collection].call : options[:collection]
20
-
20
+
21
21
  super
22
22
  end
23
-
23
+
24
24
  def destroy(env)
25
25
  if sid = current_session_id(env)
26
26
  collection.remove({'_id' => sid})
27
27
  end
28
28
  end
29
29
 
30
+ def destroy_session(env, sid, options)
31
+ collection.remove({'_id' => sid})
32
+ end
33
+
30
34
  private
31
35
  def get_session(env, sid)
32
36
  sid ||= generate_sid
@@ -39,7 +43,7 @@ module MongoSessions
39
43
  collection.update({'_id' => sid}, {'_id' => sid, 't' => Time.now, 's' => pack(session_data), 'user_id' => session_data['user_id']}, {:upsert => true})
40
44
  sid
41
45
  end
42
-
46
+
43
47
  def pack(data)
44
48
  [Marshal.dump(data)].pack("m*")
45
49
  end
@@ -49,4 +53,4 @@ module MongoSessions
49
53
  Marshal.load(packed.unpack("m*").first)
50
54
  end
51
55
  end
52
- end
56
+ end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mongo_sessions}
8
- s.version = "0.3.4"
8
+ s.version = "0.3.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mathias Biilmann"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_sessions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  version: '0'
53
53
  requirements: []
54
54
  rubyforge_project:
55
- rubygems_version: 1.8.4
55
+ rubygems_version: 1.8.23
56
56
  signing_key:
57
57
  specification_version: 3
58
58
  summary: MongoDB Session store for Rails and Rack