Class: Falcon::Configuration::Loader
- Inherits:
-
Object
- Object
- Falcon::Configuration::Loader
- Defined in:
- lib/falcon/configuration.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #add(name, *parents, &block) ⇒ Object
- #host(name, *parents, &block) ⇒ Object
-
#initialize(configuration, root = nil) ⇒ Loader
constructor
A new instance of Loader.
- #load(*features) ⇒ Object
- #proxy(name, *parents, &block) ⇒ Object
- #rack(name, *parents, &block) ⇒ Object
- #supervisor ⇒ Object
Constructor Details
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
70 71 72 |
# File 'lib/falcon/configuration.rb', line 70 def configuration @configuration end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
69 70 71 |
# File 'lib/falcon/configuration.rb', line 69 def path @path end |
Class Method Details
Instance Method Details
#add(name, *parents, &block) ⇒ Object
93 94 95 96 97 98 99 100 101 |
# File 'lib/falcon/configuration.rb', line 93 def add(name, *parents, &block) raise KeyError.new("#{name} is already set", key: name) if @environments.key?(name) environments = parents.map{|name| @environments.fetch(name)} parent = Build::Environment.combine(*environments) @environments[name] = merge(name, *parents, &block) end |
#host(name, *parents, &block) ⇒ Object
103 104 105 106 107 108 109 110 |
# File 'lib/falcon/configuration.rb', line 103 def host(name, *parents, &block) environment = merge(name, :host, *parents, &block) environment[:root] = @root environment[:authority] = name @configuration.add(environment.flatten) end |
#load(*features) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/falcon/configuration.rb', line 81 def load(*features) features.each do |feature| next if @loaded.include?(feature) relative_path = File.join(__dir__, "configurations", "#{feature}.rb") self.instance_eval(File.read(relative_path), relative_path) @loaded[feature] = relative_path end end |
#proxy(name, *parents, &block) ⇒ Object
112 113 114 115 116 117 118 119 |
# File 'lib/falcon/configuration.rb', line 112 def proxy(name, *parents, &block) environment = merge(name, :proxy, *parents, &block) environment[:root] = @root environment[:authority] = name @configuration.add(environment.flatten) end |
#rack(name, *parents, &block) ⇒ Object
121 122 123 124 125 126 127 128 |
# File 'lib/falcon/configuration.rb', line 121 def rack(name, *parents, &block) environment = merge(name, :rack, *parents, &block) environment[:root] = @root environment[:authority] = name @configuration.add(environment.flatten) end |
#supervisor ⇒ Object
130 131 132 133 134 135 136 137 |
# File 'lib/falcon/configuration.rb', line 130 def supervisor name = File.join(@root, "supervisor") environment = merge(name, :supervisor) environment[:root] = @root @configuration.add(environment.flatten) end |