Module: Torba::RemoteSources::Common

Included in:
Zip
Defined in:
lib/torba/remote_sources/common.rb

Overview

Since:

  • 0.1.0

Instance Method Summary collapse

Instance Method Details

#[](pattern) ⇒ Array<Array(String, String)>

Note:

Unlike Dir.glob doesn't include directories.

Expands pattern inside content of the remote source.

Parameters:

  • pattern (String)

    see Dir.glob for pattern examples

Returns:

  • (Array<Array(String, String)>)

    where first element of the tuple is an absolute path to cached file and second element is the same path relative to cache directory.

Since:

  • 0.1.0



10
11
12
13
14
15
16
# File 'lib/torba/remote_sources/common.rb', line 10

def [](pattern)
  ensure_cached

  Dir.glob(File.join(cache_path, pattern)).reject{ |path| File.directory?(path) }.map do |path|
    [path, path.sub(/#{cache_path}\/?/, "")]
  end
end

#digestObject

Raises:

  • (NotImplementedError)

Since:

  • 0.1.0



18
19
20
# File 'lib/torba/remote_sources/common.rb', line 18

def digest
  raise NotImplementedError
end