Class: FakeGem::FakeGemSpec

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ FakeGemSpec

Returns a new instance of FakeGemSpec.



63
64
65
66
67
68
69
70
# File 'lib/fake_gem.rb', line 63

def initialize file        
  should_exist file
  @dir, @libs = File.expand_path(File.dirname(file)), []
  
  require 'yaml'
  spec = YAML.load_file file
  self.name, self.libs = spec['name'], Array(spec['libs'])
end

Instance Attribute Details

#dirObject (readonly)

Returns the value of attribute dir.



62
63
64
# File 'lib/fake_gem.rb', line 62

def dir
  @dir
end

#libsObject

Returns the value of attribute libs.



62
63
64
# File 'lib/fake_gem.rb', line 62

def libs
  @libs
end

#nameObject

Returns the value of attribute name.



62
63
64
# File 'lib/fake_gem.rb', line 62

def name
  @name
end

Instance Method Details

#inspectObject Also known as: to_s



72
73
74
75
# File 'lib/fake_gem.rb', line 72

def inspect
  relative_libs = @libs.collect{|l| l.sub("#{@dir}/", '')}
  "fake gem #{@dir} (#{relative_libs.join(', ')})"        
end