lex-react 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/legion/extensions/react/helpers/event_matcher.rb +2 -2
- data/lib/legion/extensions/react/rule_engine.rb +1 -1
- data/lib/legion/extensions/react/runners/react.rb +4 -4
- data/lib/legion/extensions/react/version.rb +1 -1
- data/lib/legion/extensions/react.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f71f99eeab9038e0ad04b2447e615c01c936a642af8226c8f0187d0994ecd917
|
|
4
|
+
data.tar.gz: 12e0401f2ac44a9f4306a2161cf7a34dff2d68a8c9712637b6aa2838e4e47eda
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 426ffc5b872bb31bd9a9bf984e3b347c9ba9ee6445a446facc66b2f0d3c4945c6b16047b164476699d91f4fcb26977bbff6ee726d40659cbf7f020ac8a210c75
|
|
7
|
+
data.tar.gz: f2a3688c37f3d17d9ac51c4ec02dbf3858b75c8f58b243b8d80cddcda39e87e7a48b03d40f2563d2c8f62c3acd480595c1a4c0b081c9453bbeb6864b18a20b31
|
data/CHANGELOG.md
CHANGED
|
@@ -14,7 +14,7 @@ module Legion
|
|
|
14
14
|
.gsub('__DS__', '\..*')
|
|
15
15
|
regex_str = "\\A#{regex_str}\\z"
|
|
16
16
|
Regexp.new(regex_str).match?(event_name)
|
|
17
|
-
rescue RegexpError
|
|
17
|
+
rescue RegexpError => _e
|
|
18
18
|
false
|
|
19
19
|
end
|
|
20
20
|
|
|
@@ -36,7 +36,7 @@ module Legion
|
|
|
36
36
|
else
|
|
37
37
|
false
|
|
38
38
|
end
|
|
39
|
-
rescue StandardError
|
|
39
|
+
rescue StandardError => _e
|
|
40
40
|
false
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -5,7 +5,7 @@ module Legion
|
|
|
5
5
|
module React
|
|
6
6
|
module Runners
|
|
7
7
|
module React
|
|
8
|
-
|
|
8
|
+
extend self
|
|
9
9
|
|
|
10
10
|
def handle_event(event:)
|
|
11
11
|
engine = rule_engine
|
|
@@ -45,6 +45,8 @@ module Legion
|
|
|
45
45
|
@reaction_dispatcher = nil
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
private
|
|
49
|
+
|
|
48
50
|
def rule_engine
|
|
49
51
|
@rule_engine ||= RuleEngine.from_settings
|
|
50
52
|
end
|
|
@@ -68,11 +70,9 @@ module Legion
|
|
|
68
70
|
return {} unless defined?(Legion::Settings) && !Legion::Settings[:react].nil?
|
|
69
71
|
|
|
70
72
|
Legion::Settings[:react] || {}
|
|
71
|
-
rescue StandardError
|
|
73
|
+
rescue StandardError => _e
|
|
72
74
|
{}
|
|
73
75
|
end
|
|
74
|
-
|
|
75
|
-
private_class_method :rule_engine, :loop_breaker, :reaction_dispatcher, :react_settings
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
end
|
|
@@ -11,7 +11,7 @@ require_relative 'react/runners/react'
|
|
|
11
11
|
module Legion
|
|
12
12
|
module Extensions
|
|
13
13
|
module React
|
|
14
|
-
extend Legion::Extensions::Core if Legion::Extensions.const_defined?(:Core)
|
|
14
|
+
extend Legion::Extensions::Core if Legion::Extensions.const_defined?(:Core, false)
|
|
15
15
|
|
|
16
16
|
class << self
|
|
17
17
|
include Legion::Extensions::Helpers::Lex if defined?(Legion::Extensions::Helpers::Lex)
|
|
@@ -27,7 +27,7 @@ module Legion
|
|
|
27
27
|
def subscribe!
|
|
28
28
|
return unless defined?(Legion::Events)
|
|
29
29
|
|
|
30
|
-
@
|
|
30
|
+
@subscribe ||= Legion::Events.on('*') do |event| # rubocop:disable ThreadSafety/ClassInstanceVariable
|
|
31
31
|
next if event[:event].to_s.start_with?('react.')
|
|
32
32
|
|
|
33
33
|
Runners::React.handle_event(event: event)
|
|
@@ -37,10 +37,10 @@ module Legion
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def unsubscribe!
|
|
40
|
-
return unless @
|
|
40
|
+
return unless @subscribe && defined?(Legion::Events) # rubocop:disable ThreadSafety/ClassInstanceVariable
|
|
41
41
|
|
|
42
|
-
Legion::Events.off('*', @
|
|
43
|
-
@
|
|
42
|
+
Legion::Events.off('*', @subscribe) # rubocop:disable ThreadSafety/ClassInstanceVariable
|
|
43
|
+
@subscribe = nil # rubocop:disable ThreadSafety/ClassInstanceVariable
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
unless method_defined?(:log)
|
|
@@ -50,7 +50,7 @@ module Legion
|
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
require_relative 'react/actors/event_subscriber'
|
|
53
|
+
require_relative 'react/actors/event_subscriber'
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
end
|