Class: Racket::Utils::Application::RegistryBuilder
- Inherits:
-
Object
- Object
- Racket::Utils::Application::RegistryBuilder
- Defined in:
- lib/racket/utils/application/registry_builder.rb
Overview
Class for easily building a Racket::Registry.
Instance Attribute Summary collapse
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
Class Method Summary collapse
-
.static_server(static_dir, logger) ⇒ Proc|nil
Sets up a static server with the specified directory and logger.
Instance Method Summary collapse
-
#initialize(settings = {}) ⇒ RegistryBuilder
constructor
A new instance of RegistryBuilder.
Constructor Details
#initialize(settings = {}) ⇒ RegistryBuilder
Returns a new instance of RegistryBuilder.
30 31 32 33 |
# File 'lib/racket/utils/application/registry_builder.rb', line 30 def initialize(settings = {}) @settings = settings @registry = Racket::Registry.singleton_map(service_map) end |
Instance Attribute Details
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
28 29 30 |
# File 'lib/racket/utils/application/registry_builder.rb', line 28 def registry @registry end |
Class Method Details
.static_server(static_dir, logger) ⇒ Proc|nil
Sets up a static server with the specified directory and logger.
40 41 42 43 44 45 46 47 48 |
# File 'lib/racket/utils/application/registry_builder.rb', line 40 def self.static_server(static_dir, logger) unless static_dir logger.inform_dev('Static server disabled.') return nil end logger.inform_dev("Setting up static server to serve files from #{static_dir}.") handler = Rack::File.new(static_dir) ->(env) { handler.call(env) } end |