Module: Legion::Extensions::React
- Extended by:
- Core
- Includes:
- Helpers::Lex
- Defined in:
- lib/legion/extensions/react.rb,
lib/legion/extensions/react/version.rb,
lib/legion/extensions/react/rule_engine.rb,
lib/legion/extensions/react/runners/react.rb,
lib/legion/extensions/react/helpers/constants.rb,
lib/legion/extensions/react/reaction_dispatcher.rb,
lib/legion/extensions/react/helpers/loop_breaker.rb,
lib/legion/extensions/react/helpers/event_matcher.rb,
lib/legion/extensions/react/actors/event_subscriber.rb
Defined Under Namespace
Modules: Actor, Helpers, Runners
Classes: ReactionDispatcher, RuleEngine
Constant Summary
collapse
- VERSION =
'0.1.2'
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.data_required? ⇒ Boolean
19
20
21
|
# File 'lib/legion/extensions/react.rb', line 19
def data_required?
false
end
|
.remote_invocable? ⇒ Boolean
23
24
25
|
# File 'lib/legion/extensions/react.rb', line 23
def remote_invocable?
false
end
|
.subscribe! ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/legion/extensions/react.rb', line 27
def subscribe!
return unless defined?(Legion::Events)
@subscription ||= Legion::Events.on('*') do |event|
next if event[:event].to_s.start_with?('react.')
Runners::React.handle_event(event: event)
rescue StandardError => e
log.warn "[React] event handler error: #{e.message}"
end
end
|
.unsubscribe! ⇒ Object
39
40
41
42
43
44
|
# File 'lib/legion/extensions/react.rb', line 39
def unsubscribe!
return unless @subscription && defined?(Legion::Events)
Legion::Events.off('*', @subscription)
@subscription = nil
end
|
Instance Method Details
#log ⇒ Object
47
48
49
|
# File 'lib/legion/extensions/react.rb', line 47
def log
Legion::Logging
end
|