class MyPath::Handler::Gem

Public Class Methods

can_handle?(path) click to toggle source
# File lib/mypath/handler/gem.rb, line 4
def self.can_handle?(path)
  clean_path(path) =~ /\/gems\//
end
local_gem_paths() click to toggle source
# 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

Public Instance Methods

local_path() click to toggle source
# 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