Class: Falcon::Configuration
- Inherits:
-
Object
- Object
- Falcon::Configuration
- Defined in:
- lib/falcon/configuration.rb
Defined Under Namespace
Classes: Loader
Instance Attribute Summary collapse
-
#environments ⇒ Object
readonly
Returns the value of attribute environments.
Instance Method Summary collapse
- #add(environment) ⇒ Object
- #each(key = :authority) ⇒ Object
-
#initialize(verbose = false) ⇒ Configuration
constructor
A new instance of Configuration.
- #load_file(path) ⇒ Object
Constructor Details
#initialize(verbose = false) ⇒ Configuration
Returns a new instance of Configuration.
27 28 29 |
# File 'lib/falcon/configuration.rb', line 27 def initialize(verbose = false) @environments = {} end |
Instance Attribute Details
#environments ⇒ Object (readonly)
Returns the value of attribute environments.
31 32 33 |
# File 'lib/falcon/configuration.rb', line 31 def environments @environments end |
Instance Method Details
#add(environment) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/falcon/configuration.rb', line 45 def add(environment) name = environment.name unless name raise ArgumentError, "Environment name is nil #{environment.inspect}" end environment = environment.flatten raise KeyError.new("#{name.inspect} is already set", key: name) if @environments.key?(name) @environments[name] = environment end |
#each(key = :authority) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/falcon/configuration.rb', line 33 def each(key = :authority) return to_enum(key) unless block_given? @environments.each do |name, environment| environment = environment.flatten if environment.include?(key) yield environment end end end |