evnt 2.1.3 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/evnt/handler.rb +14 -20
- data/lib/evnt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5743beb843869cb039a5007f7ef2ed7787612a43
|
4
|
+
data.tar.gz: 12c347e20764ba89c54534b3d500504ad1622d8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bf390c6af6ddd639107fc025df2e9d72ed60e6e7ce767500c0328adf3ceb7cb5aafcc034f9dd77474ea5231726f1e5d67e7498bbcd3731832d1282cced709ea
|
7
|
+
data.tar.gz: 4aefe2b569c630440e9cb7d8d2e911aa3fc3e524448b36cb89d9f4f115c88234a2782ce590777b31f2b2e34599556993c8dd874f790601b15c82fcf9f0d79eac
|
data/lib/evnt/handler.rb
CHANGED
@@ -21,7 +21,6 @@ module Evnt
|
|
21
21
|
##
|
22
22
|
def notify(event)
|
23
23
|
_init_handler_data(event)
|
24
|
-
_init_handler_steps
|
25
24
|
_run_handler_steps
|
26
25
|
end
|
27
26
|
|
@@ -35,23 +34,20 @@ module Evnt
|
|
35
34
|
@event = event
|
36
35
|
end
|
37
36
|
|
38
|
-
# This function init the handler steps.
|
39
|
-
def _init_handler_steps
|
40
|
-
self.class._events[@event.name].call
|
41
|
-
end
|
42
|
-
|
43
37
|
# This function calls requested steps for the handler.
|
44
38
|
def _run_handler_steps
|
45
|
-
|
39
|
+
update_queries = "#{@event.name}_update_queries"
|
40
|
+
send(update_queries) if respond_to? update_queries
|
46
41
|
|
47
|
-
# manage event reloaded
|
48
42
|
if event.reloaded?
|
49
|
-
|
50
|
-
|
43
|
+
# manage event reloaded
|
44
|
+
manage_reloaded_event = "#{@event.name}_manage_reloaded_event"
|
45
|
+
send(manage_reloaded_event) if respond_to? manage_reloaded_event
|
46
|
+
else
|
47
|
+
# manage normal event
|
48
|
+
manage_event = "#{@event.name}_manage_event"
|
49
|
+
send(manage_event) if respond_to? manage_event
|
51
50
|
end
|
52
|
-
|
53
|
-
# manage normal event
|
54
|
-
_manage_event if defined?(_manage_event)
|
55
51
|
end
|
56
52
|
|
57
53
|
# Class functions:
|
@@ -60,27 +56,25 @@ module Evnt
|
|
60
56
|
# This class contain the list of settings for the handler.
|
61
57
|
class << self
|
62
58
|
|
63
|
-
attr_accessor :_events
|
64
|
-
|
65
59
|
# This function sets the blocks executed for a specific event.
|
66
60
|
def on(event_name, &block)
|
67
|
-
|
68
|
-
|
61
|
+
@_current_event_name = event_name
|
62
|
+
block.yield
|
69
63
|
end
|
70
64
|
|
71
65
|
# This function sets the update queries function for the event.
|
72
66
|
def to_update_queries(&block)
|
73
|
-
define_method(
|
67
|
+
define_method("#{@_current_event_name}_update_queries", &block)
|
74
68
|
end
|
75
69
|
|
76
70
|
# This function sets the manage event function for the event.
|
77
71
|
def to_manage_event(&block)
|
78
|
-
define_method(
|
72
|
+
define_method("#{@_current_event_name}_manage_event", &block)
|
79
73
|
end
|
80
74
|
|
81
75
|
# This function sets the manage reloaded event function for the event.
|
82
76
|
def to_manage_reloaded_event(&block)
|
83
|
-
define_method(
|
77
|
+
define_method("#{@_current_event_name}_manage_reloaded_event", &block)
|
84
78
|
end
|
85
79
|
|
86
80
|
end
|
data/lib/evnt/version.rb
CHANGED