Class: Seedog::Evaluator
- Inherits:
-
Object
- Object
- Seedog::Evaluator
- Defined in:
- lib/seedog/evaluator.rb
Instance Attribute Summary collapse
-
#changed ⇒ Object
Returns the value of attribute changed.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#dry_run ⇒ Object
readonly
Returns the value of attribute dry_run.
Instance Method Summary collapse
-
#initialize(config, dry_run: false) ⇒ Evaluator
constructor
A new instance of Evaluator.
- #run ⇒ Object
Constructor Details
#initialize(config, dry_run: false) ⇒ Evaluator
Returns a new instance of Evaluator.
8 9 10 11 12 |
# File 'lib/seedog/evaluator.rb', line 8 def initialize(config, dry_run: false) @config = config @dry_run = dry_run @changed = false end |
Instance Attribute Details
#changed ⇒ Object
Returns the value of attribute changed.
6 7 8 |
# File 'lib/seedog/evaluator.rb', line 6 def changed @changed end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/seedog/evaluator.rb', line 5 def config @config end |
#dry_run ⇒ Object (readonly)
Returns the value of attribute dry_run.
5 6 7 |
# File 'lib/seedog/evaluator.rb', line 5 def dry_run @dry_run end |
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/seedog/evaluator.rb', line 14 def run if dry_run puts "Apply `#{config.file.relative_path_from(Rails.root)}` (dry-run)" else puts "Apply `#{config.file.relative_path_from(Rails.root)}`" end dsl = DSL.new(self) dsl.instance_eval(config.file.read) unless changed puts 'No change' end end |