Class: Hanami::EnvironmentApplicationConfigurations Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/environment_application_configurations.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

ALL =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:all

Instance Method Summary collapse

Constructor Details

#initializeEnvironmentApplicationConfigurations

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.

Returns a new instance of EnvironmentApplicationConfigurations.



8
9
10
# File 'lib/hanami/environment_application_configurations.rb', line 8

def initialize
  @configurations = Concurrent::Hash.new { |k, v| k[v] = [] }
end

Instance Method Details

#add(environment, &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.



13
14
15
16
# File 'lib/hanami/environment_application_configurations.rb', line 13

def add(environment, &blk)
  env = (environment || ALL).to_sym
  configurations[env].push(blk)
end

#each(environment, &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.



19
20
21
22
23
24
# File 'lib/hanami/environment_application_configurations.rb', line 19

def each(environment, &blk)
  configurations.each do |env, blks|
    next unless matching_env?(environment, env)
    blks.each(&blk)
  end
end