Class: EacLauncher::Path
- Inherits:
-
String
- Object
- String
- EacLauncher::Path
show all
- Defined in:
- lib/eac_launcher/path.rb
Instance Method Summary
collapse
Instance Method Details
#basename ⇒ Object
7
8
9
|
# File 'lib/eac_launcher/path.rb', line 7
def basename
::File.basename(self)
end
|
#find_file_with_extension(extension) ⇒ Object
11
12
13
14
15
|
# File 'lib/eac_launcher/path.rb', line 11
def find_file_with_extension(extension)
r = find_files_with_extension(extension)
return r.first if r.any?
raise "Extension \"#{extension}\" not found in directory \"#{self}\""
end
|
#find_files_with_extension(extension) ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/eac_launcher/path.rb', line 17
def find_files_with_extension(extension)
r = []
::Dir.entries(self).each do |i|
r << ::File.expand_path(i, self) if i =~ /#{::Regexp.quote(extension)}\z/
end
r
end
|
#subpath(relative_path) ⇒ Object
3
4
5
|
# File 'lib/eac_launcher/path.rb', line 3
def subpath(relative_path)
::EacLauncher::Path.new(::File.expand_path(relative_path, self))
end
|