Class: SecretHub::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/secret_hub/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#dataObject (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

Raises:



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_hObject



16
17
18
# File 'lib/secret_hub/config.rb', line 16

def to_h
  @to_h ||= to_h!
end