Class: SecretHub::Config
- Inherits:
-
Object
- Object
- SecretHub::Config
- Defined in:
- lib/secret_hub/config.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Class Method Summary collapse
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #each_repo(&block) ⇒ Object
-
#initialize(data) ⇒ Config
constructor
A new instance of Config.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ Config
Returns a new instance of Config.
12 13 14 |
# File 'lib/secret_hub/config.rb', line 12 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/secret_hub/config.rb', line 5 def data @data end |
Class Method Details
.load(config_file) ⇒ Object
7 8 9 10 |
# File 'lib/secret_hub/config.rb', line 7 def self.load(config_file) raise ConfigurationError, "Config file not found #{config_flie}" unless File.exist? config_file new YAML.load_file config_file end |
Instance Method Details
#each(&block) ⇒ Object
20 21 22 |
# File 'lib/secret_hub/config.rb', line 20 def each(&block) to_h.each &block end |
#each_repo(&block) ⇒ Object
24 25 26 |
# File 'lib/secret_hub/config.rb', line 24 def each_repo(&block) to_h.keys.each &block end |
#to_h ⇒ Object
16 17 18 |
# File 'lib/secret_hub/config.rb', line 16 def to_h @to_h ||= to_h! end |