Class: File

Inherits:
Object
  • Object
show all
Defined in:
lib/ubsafe/extensions/ubsafe_file_extensions.rb

Class Method Summary collapse

Class Method Details

.join(*args) ⇒ Object

Join a list of paths as strings and/or arrays of strings

Join now works like it should! It calls .to_s on each of the args pass in. It handles nested Arrays, etc…

Parameters:

  • args (Array)

    (Nested) list of paths to join

Returns:

  • Joined list



17
18
19
20
# File 'lib/ubsafe/extensions/ubsafe_file_extensions.rb', line 17

def join(*args)
  fs = [args].flatten
  _ubsafe_original_join(fs.collect{|c| c.to_s})
end

.join_from_here(*args) ⇒ Object

Perform a join relative to the current file. Fully qualify the path name.

Parameters:

  • args (Array)

    (Nested) list of paths to join



27
28
29
30
# File 'lib/ubsafe/extensions/ubsafe_file_extensions.rb', line 27

def join_from_here(*args)
  caller.first.match(/(.+):.+/)
  File.expand_path(File.expand_path(File.join(File.dirname($1), *args)))
end