Adds the specified path to the list of directories to search for configuration files. It only allows one path to be entered at a time.
# File lib/rconfig/load_paths.rb, line 21 21: def add_load_path(path) 22: if path = parse_load_paths(path).first # only accept first one. 23: self.load_paths << path 24: self.load_paths.uniq! 25: return reload(true) # Load Paths have changed so force a reload 26: end 27: false 28: end
Indicates whether or not config_paths have been set. Returns true if self.load_paths has at least one directory.
# File lib/rconfig/load_paths.rb, line 50 50: def load_paths_set? 51: not load_paths.blank? 52: end
If the paths are made up of a delimited string, then parse out the individual paths. Verify that each path is valid.
# File lib/rconfig/load_paths.rb, line 33 33: def parse_load_paths(paths) 34: if paths.is_a? String 35: path_sep = (paths =~ /;/) ? ';' : ':' 36: paths = paths.split(/#{path_sep}+/) 37: end 38: raise ArgumentError, "Path(s) must be a String or an Array [#{paths.inspect}]" unless paths.is_a? Array 39: raise ArgumentError, "Must provide at least one load path: [#{paths.inspect}]" if paths.empty? 40: paths.each do |dir| 41: dir = CONFIG_ROOT if dir == 'CONFIG_ROOT' 42: raise InvalidLoadPathError, "This directory is invalid: [#{dir.inspect}]" unless Dir.exists?(dir) 43: end 44: paths 45: end
Sets the list of directories to search for configuration files. The argument must be an array of strings representing the paths to the directories, or a string representing either a single path or a list of paths separated by either a colon (:) or a semi-colon (;).
# File lib/rconfig/load_paths.rb, line 12 12: def set_load_paths(paths) 13: self.load_paths = parse_load_paths(paths) 14: reload(true) # Load Paths have changed so force a reload 15: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.