Class: FakeGemfile

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFakeGemfile

Returns a new instance of FakeGemfile.



4
5
6
# File 'lib/commands/gems.rb', line 4

def initialize
  @sources, @gems = [], []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *values) {|block| ... } ⇒ Object

Yields:

  • (block)


12
13
14
# File 'lib/commands/gems.rb', line 12

def method_missing(name, *values, &block)
  yield block if block_given?
end

Instance Attribute Details

#gemsObject (readonly)

Returns the value of attribute gems.



2
3
4
# File 'lib/commands/gems.rb', line 2

def gems
  @gems
end

#sourcesObject (readonly)

Returns the value of attribute sources.



2
3
4
# File 'lib/commands/gems.rb', line 2

def sources
  @sources
end

Instance Method Details

#gem(name, version = nil, options = {}) ⇒ Object



8
9
10
# File 'lib/commands/gems.rb', line 8

def gem(name, version = nil, options = {})
  @gems << {:name => name, :version => version, :options => options}
end