Class: GemPath

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_path.rb,
lib/gem_path/version.rb

Constant Summary collapse

GemNotFound =
Class.new(RuntimeError)
VERSION =
"1.0.0"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ GemPath

Returns a new instance of GemPath.



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

def initialize(name)
  @name = name
end

Class Method Details

.find(name) ⇒ Object



6
7
8
# File 'lib/gem_path.rb', line 6

def self.find(name)
  new(name).find
end

Instance Method Details

#findObject



14
15
16
17
18
19
20
# 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