Class: LocalPac::LocalStorage

Inherits:
Object
  • Object
show all
Defined in:
lib/local_pac/local_storage.rb

Instance Method Summary collapse

Constructor Details

#initialize(storage = GitStorage.new(LocalPac.config.local_storage)) ⇒ LocalStorage

Returns a new instance of LocalStorage.



10
11
12
# File 'lib/local_pac/local_storage.rb', line 10

def initialize(storage = GitStorage.new(LocalPac.config.local_storage))
  @storage   = storage
end

Instance Method Details

#find(name) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/local_pac/local_storage.rb', line 14

def find(name)
  name = name.sub(/.pac$/, '').gsub(%r{/}, '::').downcase.to_sym
  LocalPac.ui_logger.debug "Using the following name to find pac file: \":#{name}\"."
  file = storage[name]
  LocalPac.ui_logger.debug "Returning the following file: \"#{file.path || 'not found' }\"."

  file
end