Module: DhEasy::Router::Plugin::Router
- Includes:
- Core::Plugin::InitializeHook
- Included in:
- Finisher, DhEasy::Router::Parser, Seeder
- Defined in:
- lib/dh_easy/router/plugin/router.rb
Overview
Base router providing the basic functionalities from a router.
Instance Attribute Summary collapse
-
#local_config ⇒ Object
readonly
Local configuration (see DhEasy::Core::Config).
Instance Method Summary collapse
-
#class_defined?(name) ⇒ Boolean
Validates when a class name exists.
-
#config ⇒ Hash
Router configuration.
-
#get_class(name) ⇒ Class?
Get a class from a class name.
-
#initialize(opts = {}) ⇒ Object
Initialize router and hooks.
-
#initialize_hook_router_plugin_router(opts = {}) ⇒ Object
Hook to initialize router configuration.
Instance Attribute Details
#local_config ⇒ Object (readonly)
Local configuration (see DhEasy::Core::Config).
9 10 11 |
# File 'lib/dh_easy/router/plugin/router.rb', line 9 def local_config @local_config end |
Instance Method Details
#class_defined?(name) ⇒ Boolean
Validates when a class name exists
58 59 60 |
# File 'lib/dh_easy/router/plugin/router.rb', line 58 def class_defined? name Object.const_defined? name end |
#config ⇒ Hash
Router configuration.
49 50 51 |
# File 'lib/dh_easy/router/plugin/router.rb', line 49 def config local_config['router'] end |
#get_class(name) ⇒ Class?
Get a class from a class name.
67 68 69 70 |
# File 'lib/dh_easy/router/plugin/router.rb', line 67 def get_class name return nil unless class_defined? name Object.const_get name end |
#initialize(opts = {}) ⇒ Object
Initialize router and hooks.
42 43 44 |
# File 'lib/dh_easy/router/plugin/router.rb', line 42 def initialize opts = {} initialize_hooks opts end |
#initialize_hook_router_plugin_router(opts = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dh_easy/router/plugin/router.rb', line 24 def initialize_hook_router_plugin_router opts = {} opts = { config: nil, config_file_path: nil, force: false }.merge opts @local_config = opts[:config] @local_config ||= DhEasy::Config::Local.new( file_path: opts[:config_file_path], force: opts[:force] ) end |