Sha256: 04effbccca1b74a2dc9561a1fe170f927c897479d3c57f4007e3146e9c3a0de9

Contents?: true

Size: 632 Bytes

Versions: 3

Compression:

Stored size: 632 Bytes

Contents

module EacLauncher
  class Path < String
    def subpath(relative_path)
      ::EacLauncher::Path.new(::File.expand_path(relative_path, self))
    end

    def basename
      ::File.basename(self)
    end

    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 \"#{directory}\""
    end

    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eac_launcher-0.1.2 lib/eac_launcher/path.rb
eac_launcher-0.1.1 lib/eac_launcher/path.rb
eac_launcher-0.1.0 lib/eac_launcher/path.rb