Class: Octogate::ConfigLoader
- Inherits:
-
Object
- Object
- Octogate::ConfigLoader
- Defined in:
- lib/octogate/config_loader.rb
Class Method Summary collapse
Instance Method Summary collapse
- #ca_file(ca_file) ⇒ Object
-
#initialize ⇒ ConfigLoader
constructor
A new instance of ConfigLoader.
- #ssl_verify(verify) ⇒ Object
- #target(name, &block) ⇒ Object
- #token(token) ⇒ Object
Constructor Details
#initialize ⇒ ConfigLoader
Returns a new instance of ConfigLoader.
16 17 18 |
# File 'lib/octogate/config_loader.rb', line 16 def initialize @_target_builders = [] end |
Class Method Details
.load_config(config_file) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/octogate/config_loader.rb', line 4 def load_config(config_file) instance = new instance.instance_eval(File.read(config_file), config_file) instance.instance_eval do @_target_builders.each do |tb| Octogate.config.targets ||= {} Octogate.config.targets[tb.name] = tb.__to_target__ end end end |
Instance Method Details
#ca_file(ca_file) ⇒ Object
30 31 32 |
# File 'lib/octogate/config_loader.rb', line 30 def ca_file(ca_file) Octogate.config.ca_file = ca_file end |
#ssl_verify(verify) ⇒ Object
34 35 36 |
# File 'lib/octogate/config_loader.rb', line 34 def ssl_verify(verify) Octogate.config.ssl_verify = verify end |
#target(name, &block) ⇒ Object
24 25 26 27 28 |
# File 'lib/octogate/config_loader.rb', line 24 def target(name, &block) builder = TargetBuilder.new(name) builder.instance_eval(&block) @_target_builders << builder end |