class Cookbooks::SimpleConfigurationLoader
Public Class Methods
[](i = '')
click to toggle source
Public Instance Methods
iterate_over_the_yaml_files()
click to toggle source
#¶ ↑
#iterate_over_the_yaml_files¶ ↑
#¶ ↑
# File lib/cookbooks/configuration/simple_configuration_loader.rb, line 56 def iterate_over_the_yaml_files _ = @yaml_files unless _.empty? _.each {|this_yaml_file| name_of_the_method_that_is_to_be_defined = File.basename( this_yaml_file.sub(/\.yml$/,'') ).to_sym # =================================================================== # # Register which automatically defined methods will be available. # These can then be used e. g. .use_colours() # =================================================================== # @array_available_methods << name_of_the_method_that_is_to_be_defined data = YAML.load_file(this_yaml_file) self.class.class_eval { define_method(name_of_the_method_that_is_to_be_defined) { data } } } end end
obtain_all_available_yaml_files( from_this_dir = CONFIGURATION_DIRECTORY )
click to toggle source
#¶ ↑
#obtain_all_available_yaml_files¶ ↑
This method will fetch every available .yml file that is part of the “configuration system” for the Cookbooks.
#¶ ↑
# File lib/cookbooks/configuration/simple_configuration_loader.rb, line 47 def obtain_all_available_yaml_files( from_this_dir = CONFIGURATION_DIRECTORY ) @yaml_files = Dir["#{from_this_dir}*.yml"] end
reset()
click to toggle source