rom-session 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ # v0.1.1 2013-08-30
2
+
3
+ * [feature] Add Environment#start (solnic)
4
+
5
+ [Compare v0.1.0..v0.1.1](https://github.com/rom-rb/rom-relation/compare/v0.1.0...v0.1.1)
6
+
7
+ # v0.1.0 2013-08-23
8
+
9
+ First public release
@@ -10,6 +10,24 @@ require 'rom-mapper'
10
10
 
11
11
  module ROM
12
12
 
13
+ # Extended ROM::Environment with session support
14
+ class Environment
15
+
16
+ # Start a new session for this environment
17
+ #
18
+ # @example
19
+ # env.session do |session|
20
+ # # ...
21
+ # end
22
+ #
23
+ # @see Session.start
24
+ #
25
+ # @api public
26
+ def session(&block)
27
+ Session.start(self, &block)
28
+ end
29
+ end
30
+
13
31
  # Session namespace
14
32
  class Session
15
33
 
@@ -2,7 +2,17 @@
2
2
 
3
3
  module ROM
4
4
 
5
- # Extends ROM's environment with IdentityMap and state-tracking functionality
5
+ # Session with IdentityMap and state-tracking functionality
6
+ #
7
+ # @example
8
+ #
9
+ # env.session do |session|
10
+ # user = session[:users].new(id: 1, name: 'Jane')
11
+ #
12
+ # session[:users].save(user)
13
+ #
14
+ # session.flush
15
+ # end
6
16
  #
7
17
  # @api public
8
18
  class Session
@@ -3,7 +3,7 @@
3
3
  module ROM
4
4
  class Session
5
5
 
6
- VERSION = '0.1.0'.freeze
6
+ VERSION = '0.1.1'.freeze
7
7
 
8
8
  end # Session
9
9
  end # ROM
@@ -17,7 +17,7 @@ describe 'Session' do
17
17
  end
18
18
 
19
19
  specify 'fetching an object from a relation' do
20
- Session.start(users: relation) do |session|
20
+ TEST_ENV.session do |session|
21
21
  # fetch user for the first time
22
22
  jane1 = session[:users].restrict(name: 'Jane').one
23
23
 
@@ -31,7 +31,7 @@ describe 'Session' do
31
31
  end
32
32
 
33
33
  specify 'deleting an object from a relation' do
34
- Session.start(users: relation) do |session|
34
+ TEST_ENV.session do |session|
35
35
  jane = session[:users].restrict(name: 'Jane').one
36
36
 
37
37
  session[:users].delete(jane)
@@ -43,7 +43,7 @@ describe 'Session' do
43
43
  end
44
44
 
45
45
  specify 'saving an object to a relation' do
46
- Session.start(users: relation) do |session|
46
+ TEST_ENV.session do |session|
47
47
  piotr = session[:users].new(id: 3, name: 'Piotr')
48
48
 
49
49
  session[:users].save(piotr)
@@ -55,7 +55,7 @@ describe 'Session' do
55
55
  end
56
56
 
57
57
  specify 'updating an object in a relation' do
58
- Session.start(users: relation) do |session|
58
+ TEST_ENV.session do |session|
59
59
  jane = session[:users].restrict(id: 2).one
60
60
  jane.name = 'Jane Doe'
61
61
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom-session
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-08-23 00:00:00.000000000 Z
13
+ date: 2013-08-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: adamantium
@@ -91,6 +91,7 @@ files:
91
91
  - .ruby-gemset
92
92
  - .ruby-version
93
93
  - .travis.yml
94
+ - Changelog.md
94
95
  - Gemfile
95
96
  - Gemfile.devtools
96
97
  - Guardfile