Class: ConfigurationLoader

Inherits:
Loader
  • Object
show all
Defined in:
lib/shot/configuration_loader.rb

Instance Attribute Summary

Attributes inherited from Loader

#client, #type

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ConfigurationLoader

Returns a new instance of ConfigurationLoader.



15
16
17
18
19
# File 'lib/shot/configuration_loader.rb', line 15

def initialize(client)
	super(client)
	@type = 'config'
	get_all
end

Instance Method Details

#get(config_file) ⇒ Object



21
22
23
24
25
# File 'lib/shot/configuration_loader.rb', line 21

def get(config_file)
	if config_folder_exists and config_file_exists config_file then
		@client.config[config_file] = YAML.load File.read "./app/config/#{config_file}.yml"
	end
end

#get_allObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/shot/configuration_loader.rb', line 27

def get_all
	if config_folder_exists
		config_folder = Dir.new './app/config/'

		config_folder.each do |file|
			if file != '.' and file != '..'
				file['.yml'] = ''
				get file
			end
		end
	end
end