Module: JTask::Helpers
- Defined in:
- lib/jtask/helpers.rb
Class Method Summary collapse
Class Method Details
.set_directory(custom_directory = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/jtask/helpers.rb', line 5 def self.set_directory(custom_directory=nil) # Check if user has specified a custom directory in the method if custom_directory # Yes, lets use it. dir = custom_directory else # No, lets load the default directory. dir = JTask.configuration.file_dir end # Panic if the directory doesn't exist. Literally. unless File.directory?(dir) raise RuntimeError, "[JTask] The directory '#{dir}' doesn't exist in your current location. Please create it or refer to the documentation on how to change your file path." end return dir end |