Module: SchwabRb::PathSupport

Defined in:
lib/schwab_rb/path_support.rb

Class Method Summary collapse

Class Method Details

.ensure_parent_directory(path) ⇒ Object



15
16
17
18
# File 'lib/schwab_rb/path_support.rb', line 15

def ensure_parent_directory(path)
  directory = File.dirname(expand_path(path))
  FileUtils.mkdir_p(directory)
end

.expand_path(path) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
13
# File 'lib/schwab_rb/path_support.rb', line 9

def expand_path(path)
  raise ArgumentError, "path is nil or empty" if path.nil? || path.to_s.strip.empty?

  File.expand_path(path.to_s)
end