Class: Appraisal::AppraisalFile
- Inherits:
-
Object
- Object
- Appraisal::AppraisalFile
- Defined in:
- lib/appraisal/appraisal_file.rb
Overview
Loads and parses Appraisals file
Instance Attribute Summary collapse
-
#appraisals ⇒ Object
readonly
Returns the value of attribute appraisals.
-
#gemfile ⇒ Object
readonly
Returns the value of attribute gemfile.
Class Method Summary collapse
Instance Method Summary collapse
- #appraise(name, &block) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ AppraisalFile
constructor
A new instance of AppraisalFile.
Constructor Details
#initialize ⇒ AppraisalFile
Returns a new instance of AppraisalFile.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/appraisal/appraisal_file.rb', line 14 def initialize @appraisals = [] @gemfile = Gemfile.new @gemfile.load(ENV['BUNDLE_GEMFILE'] || 'Gemfile') if File.exist? path run IO.read(path) else raise AppraisalsNotFound end end |
Instance Attribute Details
#appraisals ⇒ Object (readonly)
Returns the value of attribute appraisals.
8 9 10 |
# File 'lib/appraisal/appraisal_file.rb', line 8 def appraisals @appraisals end |
#gemfile ⇒ Object (readonly)
Returns the value of attribute gemfile.
8 9 10 |
# File 'lib/appraisal/appraisal_file.rb', line 8 def gemfile @gemfile end |
Class Method Details
.each(&block) ⇒ Object
10 11 12 |
# File 'lib/appraisal/appraisal_file.rb', line 10 def self.each(&block) new.each(&block) end |
Instance Method Details
#appraise(name, &block) ⇒ Object
30 31 32 33 34 |
# File 'lib/appraisal/appraisal_file.rb', line 30 def appraise(name, &block) appraisal = Appraisal.new(name, gemfile) appraisal.instance_eval(&block) @appraisals << appraisal end |
#each(&block) ⇒ Object
26 27 28 |
# File 'lib/appraisal/appraisal_file.rb', line 26 def each(&block) appraisals.each(&block) end |