Class: Appraisal::PathSource
- Inherits:
-
Object
- Object
- Appraisal::PathSource
- Defined in:
- lib/appraisal/path_source.rb
Instance Method Summary collapse
- #gem(name, *requirements) ⇒ Object
-
#initialize(source, options = {}) ⇒ PathSource
constructor
A new instance of PathSource.
- #run(&block) ⇒ Object
- #to_s ⇒ Object
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, = {}) @dependencies = DependencyList.new @source = source @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_s ⇒ Object
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 |