Module: Torba::RemoteSources::Common
Overview
Instance Method Summary collapse
-
#[](pattern) ⇒ Array<Array(String, String)>
Expands pattern inside content of the remote source.
-
#digest ⇒ String
Unique short name used as a representation of the remote source.
Instance Method Details
#[](pattern) ⇒ Array<Array(String, String)>
Note:
Unlike Dir.glob doesn’t include directories.
Expands pattern inside content of the remote source.
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)).sort.reject{ |path| File.directory?(path) }.map do |path| [File.absolute_path(path), path.sub(/#{cache_path}\/?/, "")] end end |
#digest ⇒ String
Returns unique short name used as a representation of the remote source. Used by default as a cache folder name.
20 21 22 |
# File 'lib/torba/remote_sources/common.rb', line 20 def digest raise NotImplementedError end |