Class: FakeGem::FakeGemSpec
- Inherits:
-
Object
- Object
- FakeGem::FakeGemSpec
- Defined in:
- lib/fake_gem.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
Returns the value of attribute dir.
- #libs(*args) ⇒ Object
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.
21 22 23 24 25 |
# File 'lib/fake_gem.rb', line 21 def initialize file should_exist file @dir, @libs = File.(File.dirname(file)), [] instance_eval File.read(file), __FILE__, __LINE__ end |
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
20 21 22 |
# File 'lib/fake_gem.rb', line 20 def dir @dir end |
#libs(*args) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/fake_gem.rb', line 27 def libs *args if args.empty? @libs else args = args.first if args.first.is_a? Array args = args.collect do |d| d = d.to_s d = (d =~ /^\//) ? d : "#{dir}/#{d}" should_exist d d end @libs.push *args end end |
Instance Method Details
#inspect ⇒ Object Also known as: to_s
43 44 45 46 |
# File 'lib/fake_gem.rb', line 43 def inspect relative_libs = @libs.collect{|l| l.sub("#{@dir}/", '')} "fake gem #{@dir} (#{relative_libs.join(', ')})" end |