class GemPath

Constants

GemNotFound
VERSION

Attributes

name[R]

Public Class Methods

find(name) click to toggle source
# File lib/gem_path.rb, line 6
def self.find(name)
  new(name).find
end
new(name) click to toggle source
# File lib/gem_path.rb, line 10
def initialize(name)
  @name = name
end

Public Instance Methods

find() click to toggle source
# File lib/gem_path.rb, line 14
def find
  if gem_exists?
    gemspec.gem_dir
  else
    raise GemNotFound, "Couldn't find gem directory for '#{name}'"
  end
end

Private Instance Methods

gem_exists?() click to toggle source
# File lib/gem_path.rb, line 25
def gem_exists?
  !Gem::Specification.find_all_by_name(name).empty?
end
gemspec() click to toggle source
# File lib/gem_path.rb, line 29
def gemspec
  @_gemspec ||= Gem::Specification.find_by_name(name)
end