config.rb 467 B

123456789101112131415161718192021222324
  1. # frozen_string_literal: true
  2. require 'yaml'
  3. # NeoInfra Account information
  4. module NeoInfra
  5. # load the config
  6. class Config
  7. attr_reader :config
  8. def initialize(cfg = 'config.yaml')
  9. @config = YAML.load_file(
  10. File.join(File.dirname(File.expand_path(__FILE__)),
  11. '..', '..', cfg)
  12. )
  13. @config.keys.each do |c|
  14. define_singleton_method(c.to_sym) do
  15. @config[c]
  16. end
  17. end
  18. end
  19. end
  20. end