action_sequence 0.0.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 77ee7260c00343238d0585e9719df521f9a8a68ed365c49b2c929a22ee71c98b
4
- data.tar.gz: a121847ce23c49ca488119553f134aded0785c8f61f151d9efbdc5c107ce78f1
3
+ metadata.gz: 3ad85b7f3eebc0a5c2643bef6045873a4d2e84a47e1db3883a20935ab1f1bcd1
4
+ data.tar.gz: 0a5da8930f1027167590d8b50cd552be7d7cc9541d51f99ffa4adb4d598a69d3
5
5
  SHA512:
6
- metadata.gz: 4978e0d73affe9269ad682d6fb452d8a42751d6af21e797a30b38c26a3ba3c634a924378a41cc45df772bab4c077806ea14fd11fe1ec33014ba29992d96d2711
7
- data.tar.gz: 177a8d4a34791a06d06330fc3668170c0d5ebb9919a4d46028103f0f8bca049c666cba285393f52a2c463d30565464950bed88ef1995e8d31261666fdb47b846
6
+ metadata.gz: 3680d65056a53ae75733b5e377d82213a53eb16337372fb13150f952a369283ca932cee9d25ee1b1fb084bbd4d0198795a21211ee14ffddc3077e4d725500a1e
7
+ data.tar.gz: 72b45d91171df7d0ee34522270a53d4e23e9354e8b4c2922d36f577b802f3cc5d92ed2e56888b92a4e19e4fd9df2a673de6205560ea1d66fb349c3f351f4ccbc
@@ -2,4 +2,3 @@
2
2
 
3
3
  require_relative './action_sequence/context'
4
4
  require_relative './action_sequence/sequence'
5
- require_relative './action_sequence/transaction_sequence.rb'
@@ -14,7 +14,7 @@ module ActionSequence
14
14
  end
15
15
 
16
16
  def add_to_context!(hash)
17
- @context.merge!(hash)
17
+ context.merge!(hash)
18
18
  end
19
19
 
20
20
  def failed?
@@ -29,8 +29,12 @@ module ActionSequence
29
29
  @error_message = error_message
30
30
  end
31
31
 
32
- def fetch(key)
33
- @context.fetch(key)
32
+ def fetch(key, default)
33
+ context.fetch(key, default)
34
34
  end
35
+
36
+ private
37
+
38
+ attr_reader :context
35
39
  end
36
40
  end
@@ -12,13 +12,17 @@ module ActionSequence
12
12
  end
13
13
 
14
14
  def call
15
- @actions.each do |action|
16
- return @context if @context.failed?
15
+ actions.each do |action|
16
+ return context if context.failed?
17
17
 
18
- action.call(@context)
18
+ action.call(context)
19
19
  end
20
20
 
21
- @context
21
+ context
22
22
  end
23
+
24
+ private
25
+
26
+ attr_reader :actions, :context
23
27
  end
24
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_sequence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James A. Sral
@@ -19,7 +19,6 @@ files:
19
19
  - lib/action_sequence.rb
20
20
  - lib/action_sequence/context.rb
21
21
  - lib/action_sequence/sequence.rb
22
- - lib/action_sequence/transaction_sequence.rb
23
22
  homepage: https://rubygems.org/gems/action_sequence
24
23
  licenses:
25
24
  - MIT
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionSequence
4
- ###
5
- # A Sequence that calls its actions in a transaction
6
- ##
7
- class TransactionSequence < Sequence
8
- def call
9
- ::ActiveRecord::Base.transaction do
10
- super
11
- end
12
- end
13
- end
14
- end