Module: Legion::Extensions::Core
- Defined in:
- lib/legion/extensions/core.rb
Instance Attribute Summary
Attributes included from Builder::Actors
Attributes included from Builder::Runners
Instance Method Summary collapse
- #auto_generate_transport ⇒ Object
- #autobuild ⇒ Object
-
#build_settings ⇒ Object
rubocop:disable Metrics/AbcSize.
- #build_transport ⇒ Object
- #default_settings ⇒ Object
Methods included from Builder::Actors
#actor_files, #build_actor_list, #build_actors, #build_meta_actor, #build_meta_actor_list
Methods included from Builder::Base
#const_defined_two?, #define_constant_two, #define_get, #find_files, #require_files
Methods included from Builder::Helpers
#build_helpers, #helper_files, #helpers
Methods included from Builder::Runners
#build_runner_list, #build_runners, #runner_files
Methods included from Helpers::Lex
Methods included from Helpers::Logger
Methods included from Helpers::Core
Methods included from Helpers::Base
#actor_class, #actor_const, #actor_name, #calling_class, #calling_class_array, #from_json, #full_path, #lex_class, #lex_const, #lex_name, #normalize, #runner_class, #runner_const, #runner_name, #to_dotted_hash
Methods included from Helpers::Transport
#build_default_exchange, #default_exchange, #exchanges, #messages, #queues, #transport_class, #transport_path
Instance Method Details
#auto_generate_transport ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/legion/extensions/core.rb', line 85 def auto_generate_transport require 'legion/extensions/transport' log.debug 'running meta magic to generate a transport base class' return if Kernel.const_defined? "#{lex_class}::Transport" Kernel.const_get(lex_class.to_s).const_set('Transport', Module.new { extend Legion::Extensions::Transport }) end |
#autobuild ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/legion/extensions/core.rb', line 29 def autobuild @actors = {} @meta_actors = {} @runners = {} @helpers = [] @queues = {} @exchanges = {} @messages = {} build_settings build_transport build_helpers build_runners build_actors end |
#build_settings ⇒ Object
rubocop:disable Metrics/AbcSize
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/legion/extensions/core.rb', line 59 def build_settings # rubocop:disable Metrics/AbcSize if Legion::Settings[:extensions].key?(lex_name.to_sym) Legion::Settings[:default_extension_settings].each do |key, value| Legion::Settings[:extensions][lex_name.to_sym][key.to_sym] = if Legion::Settings[:extensions][lex_name.to_sym].key?(key.to_sym) value.merge(Legion::Settings[:extensions][lex_name.to_sym][key.to_sym]) else value end end else Legion::Settings[:extensions][lex_name.to_sym] = Legion::Settings[:default_extension_settings] end default_settings.each do |key, value| Legion::Settings[:extensions][lex_name.to_sym][key.to_sym] = if Legion::Settings[:extensions][lex_name.to_sym].key?(key.to_sym) value.merge(Legion::Settings[:extensions][lex_name.to_sym][key.to_sym]) else value end end end |
#build_transport ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/legion/extensions/core.rb', line 45 def build_transport if File.exist? "#{extension_path}/transport/autobuild.rb" require "#{extension_path}/transport/autobuild" extension_class::Transport::AutoBuild.build log.warn 'still using transport::autobuild, please upgrade' elsif File.exist? "#{extension_path}/transport.rb" require "#{extension_path}/transport" extension_class::Transport.build else auto_generate_transport extension_class::Transport.build end end |
#default_settings ⇒ Object
81 82 83 |
# File 'lib/legion/extensions/core.rb', line 81 def default_settings {} end |