reactor 0.4.6 → 0.4.7

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: 3d94c9e88b1e39de193207ebfb0ac79144ec9506
4
- data.tar.gz: e5d673c488dc337113cf581c715fcdeb1da9da09
3
+ metadata.gz: 5ace8ce445f2aebac77523482a0a16112cda5143
4
+ data.tar.gz: 1844c28133029e8b9ed6d1eac32793efd2a58ede
5
5
  SHA512:
6
- metadata.gz: b4a8ac148d6b9c2d1bcf5686b7bd6a3db9247be7853bde3671d1b72bb01b982d3691b8c5470e26406b95a922c820578684097c68574274efa51b8a1414cc9a66
7
- data.tar.gz: 5ade72a5fc8fc294710fd6be3910ef3f03f12daa0ad1f83f5cc353fe175475bd537e467fa06a5f83f827f577921d9ea35521123373764dc508f6cf57e77cbb24
6
+ metadata.gz: d268ec515c2b5e26577ebac12299a4969de3a17721e8dd02d9509b0b10cc8010115331d55ca3a8b133e7e51de619b30a1e4ccea9cc3f915c3ed7237ee60f998d
7
+ data.tar.gz: d0c4f6f3d2b99293034ffb76f06b48a34ed7a4b23a917801706478d390ea115a9a6f827ef843f3cbc8dd8ea1ea1b2ab0a9ab4984d9f81b08c5f13c341a656f38
data/.gitignore CHANGED
@@ -15,6 +15,7 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ tags
18
19
  .rvmrc
19
20
  .ruby-version
20
- .ruby-gemset
21
+ .ruby-gemset
data/lib/reactor/event.rb CHANGED
@@ -70,7 +70,7 @@ class Reactor::Event
70
70
  def reschedule(name, data = {})
71
71
  scheduled_jobs = Sidekiq::ScheduledSet.new
72
72
  job = scheduled_jobs.detect do |job|
73
- job['class'] == self.class.name.to_s
73
+ job['class'] == self.name.to_s &&
74
74
  job['args'].first == name.to_s &&
75
75
  job.score.to_i == data[:was].to_i
76
76
  end
@@ -2,7 +2,7 @@ module Reactor::Publishable
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- after_commit :schedule_events, if: :persisted?, on: :create
5
+ after_commit :schedule_events, if: :persisted?
6
6
  after_commit :reschedule_events, if: :persisted?, on: :update
7
7
  end
8
8
 
@@ -31,11 +31,11 @@ module Reactor::Publishable
31
31
  ).except(:watch, :if)
32
32
  need_to_fire = case (ifarg = data[:if])
33
33
  when Proc
34
- instance_exec &ifarg
34
+ instance_exec(&ifarg)
35
35
  when Symbol
36
36
  send(ifarg)
37
37
  else
38
- true
38
+ transaction_include_action?(:create)
39
39
  end
40
40
  Reactor::Event.publish name, event if need_to_fire
41
41
  end
@@ -46,20 +46,13 @@ module Reactor::Publishable
46
46
  attr_changed_method = data[:watch] || data[:at]
47
47
  if data[:at] && previous_changes[attr_changed_method]
48
48
  Reactor::Event.reschedule name,
49
- at: send(data[:at]),
50
- actor: ( data[:actor] ? send(data[:actor]) : self ),
51
- target: ( data[:target] ? self : nil),
52
- was: previous_changes[data[:at]].try(:first) || send("#{data[:at]}_was")
53
- end
54
- if data[:if]
55
- need_to_fire = case (ifarg = data[:if])
56
- when Proc
57
- instance_exec &ifarg
58
- when Symbol
59
- send(ifarg)
60
- end
61
- Reactor::Event.publish name, actor: self if need_to_fire
49
+ data.merge(
50
+ at: send(data[:at]),
51
+ actor: ( data[:actor] ? send(data[:actor]) : self ),
52
+ target: ( data[:target] ? self : nil),
53
+ was: previous_changes[data[:at]].try(:first) || send("#{data[:at]}_was"))
62
54
  end
63
55
  end
64
56
  end
65
- end
57
+
58
+ end
@@ -1,3 +1,3 @@
1
1
  module Reactor
2
- VERSION = "0.4.6"
2
+ VERSION = "0.4.7"
3
3
  end
data/reactor.gemspec CHANGED
@@ -6,8 +6,8 @@ require 'reactor/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "reactor"
8
8
  spec.version = Reactor::VERSION
9
- spec.authors = ["winfred", "walt"]
10
- spec.email = ["winfred@developerauction.com", "walt@developerauction.com", "curtis@developerauction.com", "nate@developerauction.com"]
9
+ spec.authors = ["winfred", "walt", "nate", "cgag", "petermin"]
10
+ spec.email = ["winfred@developerauction.com", "walt@developerauction.com", "curtis@developerauction.com", "nate@developerauction.com", "kengteh.min@gmail.com"]
11
11
  spec.description = %q{ rails chrono reactor }
12
12
  spec.summary = %q{ Sidekiq/ActiveRecord pubsub lib }
13
13
  spec.homepage = ""
@@ -17,7 +17,7 @@ class Auction < ActiveRecord::Base
17
17
 
18
18
  publishes :bell
19
19
  publishes :ring, at: :ring_timeout, watch: :start_at
20
- publishes :begin, at: :start_at
20
+ publishes :begin, at: :start_at, additional_info: 'curtis was here'
21
21
  publishes :conditional_event_on_save, if: -> { we_want_it }
22
22
  publishes :woof, actor: :pet, target: :self
23
23
  end
@@ -62,7 +62,8 @@ describe Reactor::Publishable do
62
62
  hash_including(
63
63
  at: new_start_at,
64
64
  actor: auction,
65
- was: start_at
65
+ was: start_at,
66
+ additional_info: 'curtis was here'
66
67
  )
67
68
  auction.start_at = new_start_at
68
69
  auction.save!
@@ -118,4 +119,4 @@ describe Reactor::Publishable do
118
119
  TestSubscriber.class_variable_get(:@@called).should be_true
119
120
  end
120
121
  end
121
- end
122
+ end
metadata CHANGED
@@ -1,15 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reactor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - winfred
8
8
  - walt
9
+ - nate
10
+ - cgag
11
+ - petermin
9
12
  autorequire:
10
13
  bindir: bin
11
14
  cert_chain: []
12
- date: 2013-07-22 00:00:00.000000000 Z
15
+ date: 2013-08-07 00:00:00.000000000 Z
13
16
  dependencies:
14
17
  - !ruby/object:Gem::Dependency
15
18
  name: sidekiq
@@ -87,6 +90,7 @@ email:
87
90
  - walt@developerauction.com
88
91
  - curtis@developerauction.com
89
92
  - nate@developerauction.com
93
+ - kengteh.min@gmail.com
90
94
  executables: []
91
95
  extensions: []
92
96
  extra_rdoc_files: []