Sha256: 867a6dfe8a3913b8ee866ef08e27075be083c982108a2198b435fd0aa84fcbcf
Contents?: true
Size: 611 Bytes
Versions: 5
Compression:
Stored size: 611 Bytes
Contents
module Hanami class EnvironmentApplicationConfigurations ALL = :all def initialize @configurations = Concurrent::Hash.new { |k, v| k[v] = [] } end def add(environment, &blk) env = (environment || ALL).to_sym configurations[env].push(blk) end def each(environment, &blk) configurations.each do |env, blks| next unless matching_env?(environment, env) blks.each(&blk) end end private attr_reader :configurations def matching_env?(environment, env) environment.to_sym == env || env == ALL end end end
Version data entries
5 entries across 5 versions & 1 rubygems