stance 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stance.rb +10 -0
- data/lib/stance/eventable.rb +3 -3
- data/lib/stance/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51b0695fffdd5e9543b325277fabfd2244cac3a84ffefb2660ed9c48499bdf12
|
4
|
+
data.tar.gz: 28c77b84783964cc08617e2d28b8c1906105fe621b4ad83236bb571327e6dfc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2816cde14c5643554d55faa81122667e13b123bc8591e8d959d412a40e204b72aeca434b41a4b98a5270b07f828652f59064e60851c5e9e83a34aa21b6c97b52
|
7
|
+
data.tar.gz: '049bd51dd0ddb46eaa7e52b4a2fa0f7a709fd1c101510499637411c5d55e0ae374e5fca1de23a30760276213b1b38b43a56c353f392df9fe20272cee46eb0dcc'
|
data/lib/stance.rb
CHANGED
@@ -6,6 +6,16 @@ require 'stance/engine'
|
|
6
6
|
module Stance
|
7
7
|
class EventNotFound < StandardError; end
|
8
8
|
|
9
|
+
mattr_accessor :disabled_events
|
10
|
+
@@disabled_events = []
|
11
|
+
|
12
|
+
def self.disable(*events)
|
13
|
+
disabled_events.concat events
|
14
|
+
yield
|
15
|
+
ensure
|
16
|
+
self.disabled_events -= events
|
17
|
+
end
|
18
|
+
|
9
19
|
autoload :Events, 'stance/events'
|
10
20
|
autoload :Event, 'stance/event'
|
11
21
|
autoload :Eventable, 'stance/eventable'
|
data/lib/stance/eventable.rb
CHANGED
@@ -21,9 +21,9 @@ module Stance
|
|
21
21
|
event_class_name = "#{events_class_name}::#{name.to_s.tr('.', '/').classify}"
|
22
22
|
ev = event_class(event_class_name).new(name, self, metadata, events_class.events[name])
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
return ev if Stance.disabled_events.include?(ev.full_name)
|
25
|
+
|
26
|
+
events_class.new(ev).run_callbacks(:create) { ev.create }
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
data/lib/stance/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Moss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|