Class: File
- Inherits:
-
Object
- Object
- File
- Defined in:
- lib/condor.rb
Overview
Extensions to the File class.
Class Method Summary collapse
-
.files_on_path(name, path = ) ⇒ Object
Find all instances of the specified file on the path.
-
.path_specified?(fullname) ⇒ Boolean
Does the specified full filename have a path component?.
Class Method Details
.files_on_path(name, path = ) ⇒ Object
Find all instances of the specified file on the path.
189 190 191 192 193 194 |
# File 'lib/condor.rb', line 189 def File.files_on_path(name, path = ENV["PATH"]) return [name] if path_specified?(name) path.split(File::PATH_SEPARATOR).collect do |p| File.join(p, name) end.select {|f| File.exists?(f)} end |
.path_specified?(fullname) ⇒ Boolean
Does the specified full filename have a path component?
184 185 186 |
# File 'lib/condor.rb', line 184 def File.path_specified?(fullname) not basename(fullname) == fullname end |