piko_transaction 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06472962146b076955c5c0131923f2e0395598c2
4
- data.tar.gz: 19668ac71181d29ddb5cebf6a1175ec0e665c951
3
+ metadata.gz: e2a5c353c83ff13ddda8d02da3472d26817097f3
4
+ data.tar.gz: bd2b2647b33ac8b31909d2362bc41c821280b8e2
5
5
  SHA512:
6
- metadata.gz: 6136443b54f0286ef78f5a1f2e1272a0740a6c402849652d5aa96efdb7baa5f6a2403258e773103cab6b195c9bdfe2363dfa44729ce42dcb3421c209cef5b896
7
- data.tar.gz: e13a8171c0c626f368dfe0e2412934b0eb865cb0197514a1673b8de917ac23bc5028ff852a4d5d1d40a1b1c2f901f7043ad9a1f02b10dbbe6317847598b812c1
6
+ metadata.gz: 74bb0c9fd14f7feaf3cee6f36725a7e6ceb47a300ab822153c834c4bf994d4375775c9db875b26bb33c5022880ef78ef1ba8890b5ebfe816bac9fdcd05036518
7
+ data.tar.gz: 54f72334b93ebe20e88f6ffe72ada7328f6f4c12f1923eae165aa7c4f33c667ea96c1b9ffbb910748d6b791bb9d2922d73dbd6e9974812a19ed76508fe817abc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 2.1.0 (2017.06.08)
2
+
3
+ * add transaction holder class
4
+
1
5
  ### 2.0.0 (2017.06.08)
2
6
 
3
7
  * change transaction interface: run -> do, roll_back -> undo
@@ -18,5 +18,7 @@
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
20
  require "piko_transaction/transaction"
21
+ require "piko_transaction/transaction_holder"
21
22
  require "piko_transaction/insert_command"
22
23
  require "piko_transaction/delete_command"
24
+ require "piko_transaction/custom_command"
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017 Szymon Kopciewski
4
+ #
5
+ # This file is part of PikoTransaction.
6
+ #
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+
20
+ require "piko_transaction/logger"
21
+ require "piko_transaction/transaction"
22
+
23
+ module PikoTransaction
24
+ class TransactionHolder
25
+ include Logger
26
+
27
+ def initialize
28
+ @transactions = {}
29
+ end
30
+
31
+ def method_missing(method_name, *args, &block)
32
+ logger.debug { format "Looking for transaction '%s'", method_name }
33
+ return super unless valid_method_name?(method_name)
34
+ @transactions[method_name] ||= Transaction.new
35
+ end
36
+
37
+ private
38
+
39
+ def respond_to_missing?(method_name, include_private = false)
40
+ return true if valid_method_name?(method_name)
41
+ super
42
+ end
43
+
44
+ def valid_method_name?(name)
45
+ /^\w+$/.match? name
46
+ end
47
+ end
48
+ end
@@ -18,5 +18,5 @@
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
20
  module PikoTransaction
21
- VERSION = "2.0.0"
21
+ VERSION = "2.1.0"
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piko_transaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Szymon Kopciewski
@@ -125,6 +125,7 @@ files:
125
125
  - lib/piko_transaction/insert_command.rb
126
126
  - lib/piko_transaction/logger.rb
127
127
  - lib/piko_transaction/transaction.rb
128
+ - lib/piko_transaction/transaction_holder.rb
128
129
  - lib/piko_transaction/version.rb
129
130
  homepage: https://github.com/skopciewski/piko_transaction
130
131
  licenses: