Class: Inventory::Server::Server
- Inherits:
-
Object
- Object
- Inventory::Server::Server
- Defined in:
- lib/inventory/server.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#middlewares ⇒ Object
readonly
Returns the value of attribute middlewares.
Instance Method Summary collapse
-
#initialize(cli_config) ⇒ Server
constructor
A new instance of Server.
Constructor Details
#initialize(cli_config) ⇒ Server
Returns a new instance of Server.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/inventory/server.rb', line 12 def initialize(cli_config) config = Config.generate(cli_config) @config = config InventoryLogger.setup(config[:logger]) InventoryLogger.logger.level = config[:log_level] # Dynamically load plugins from plugins_path plugin_names = config[:plugins] @middlewares = Middleware::Builder.new do plugins = Loader.new(config).load_plugins(*plugin_names) plugins.each {|klass| use klass, config } end end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/inventory/server.rb', line 10 def config @config end |
#middlewares ⇒ Object (readonly)
Returns the value of attribute middlewares.
10 11 12 |
# File 'lib/inventory/server.rb', line 10 def middlewares @middlewares end |