Class: FakeGem::FakeGemSpec
- Inherits:
-
Object
- Object
- FakeGem::FakeGemSpec
- Defined in:
- lib/fake_gem.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#libs ⇒ Object
readonly
Returns the value of attribute libs.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(file) ⇒ FakeGemSpec
constructor
A new instance of FakeGemSpec.
- #inspect ⇒ Object (also: #to_s)
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.(File.dirname(file)), [] require 'yaml' spec = YAML.load_file file self.name, self.libs = spec['name'], Array(spec['libs']) end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
62 63 64 |
# File 'lib/fake_gem.rb', line 62 def dir @dir end |
#libs ⇒ Object
Returns the value of attribute libs.
62 63 64 |
# File 'lib/fake_gem.rb', line 62 def libs @libs end |
#name ⇒ Object
Returns the value of attribute name.
62 63 64 |
# File 'lib/fake_gem.rb', line 62 def name @name end |
Instance Method Details
#inspect ⇒ Object 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 |