Class: MyPath::Handler::Gem
Instance Attribute Summary
#path
Class Method Summary
collapse
Instance Method Summary
collapse
clean_path, for, inherited, #initialize
Class Method Details
.can_handle?(path) ⇒ Boolean
4
5
6
|
# File 'lib/mypath/handler/gem.rb', line 4
def self.can_handle?(path)
clean_path(path) =~ /\/gems\//
end
|
.local_gem_paths ⇒ Object
8
9
10
|
# File 'lib/mypath/handler/gem.rb', line 8
def self.local_gem_paths
@local_gem_paths ||= ::Gem.path.collect{ |g| File.join(g, 'gems') }
end
|
Instance Method Details
#local_path ⇒ Object
12
13
14
15
16
|
# File 'lib/mypath/handler/gem.rb', line 12
def local_path
remote_gem_path = /.*?\/gems\/.*?([^\/]+?-\d\..*)/.match(self.path)[1]
joined = self.class.local_gem_paths.collect{|g| File.join(g, remote_gem_path)}
Dir[*joined].first
end
|