Module: Hanami::Application::ClassMethods Private
- Defined in:
- lib/hanami/application.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Class interface for Hanami applications
Class Method Summary collapse
-
.extended(base) ⇒ Object
private
Override Ruby’s Class#extended.
Instance Method Summary collapse
-
#app_name ⇒ String
private
Hanami application name.
-
#configuration=(configuration) ⇒ Object
private
Set configuration.
-
#configure(environment = nil, &blk) ⇒ Object
private
Configure the application.
Class Method Details
.extended(base) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Override Ruby’s Class#extended
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/hanami/application.rb', line 61 def self.extended(base) # rubocop:disable Metrics/MethodLength super base.class_eval do @namespace = ApplicationNamespace.resolve(name) @configurations = EnvironmentApplicationConfigurations.new @_lock = Mutex.new class << self # @since 0.9.0 # @api private attr_reader :namespace # @since 0.9.0 # @api private attr_reader :configurations # @since 0.9.0 # @api private attr_reader :configuration end end end |
Instance Method Details
#app_name ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Hanami application name
101 102 103 |
# File 'lib/hanami/application.rb', line 101 def app_name ApplicationName.new(name).to_s end |
#configuration=(configuration) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set configuration
113 114 115 116 117 118 |
# File 'lib/hanami/application.rb', line 113 def configuration=(configuration) @_lock.synchronize do # raise "Can't assign configuration more than once (#{app_name})" unless @configuration.nil? @configuration = configuration end end |
#configure(environment = nil, &blk) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Configure the application. It yields the given block in the context of the configuration
140 141 142 |
# File 'lib/hanami/application.rb', line 140 def configure(environment = nil, &blk) configurations.add(environment, &blk) end |