Class: Appraisal::PathSource

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

Instance Method Summary collapse

Constructor Details

#initialize(source, options = {}) ⇒ PathSource

Returns a new instance of PathSource.



6
7
8
9
10
# File 'lib/appraisal/path_source.rb', line 6

def initialize(source, options = {})
  @dependencies = DependencyList.new
  @source = source
  @options = options
end

Instance Method Details

#gem(name, *requirements) ⇒ Object



12
13
14
# File 'lib/appraisal/path_source.rb', line 12

def gem(name, *requirements)
  @dependencies.add(name, requirements)
end

#run(&block) ⇒ Object



16
17
18
# File 'lib/appraisal/path_source.rb', line 16

def run(&block)
  instance_exec(&block)
end

#to_sObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/appraisal/path_source.rb', line 20

def to_s
  dependencies = @dependencies.to_s.strip.gsub(/^/, '  ')

  if @options.empty?
    "path #{@source.inspect} do\n#{dependencies}\nend"
  else
    "path #{@source.inspect}, #{Utils.format_string(@options)} do\n" +
      "#{dependencies}\nend"
  end
end