Class: SchemaDev::MatrixExecutor
- Inherits:
-
Object
- Object
- SchemaDev::MatrixExecutor
- Defined in:
- lib/schema_dev/matrix_executor.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(matrix) ⇒ MatrixExecutor
constructor
A new instance of MatrixExecutor.
- #run(cmd, dry_run: false) ⇒ Object
Constructor Details
#initialize(matrix) ⇒ MatrixExecutor
Returns a new instance of MatrixExecutor.
7 8 9 |
# File 'lib/schema_dev/matrix_executor.rb', line 7 def initialize(matrix) @matrix = matrix end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'lib/schema_dev/matrix_executor.rb', line 5 def errors @errors end |
Instance Method Details
#run(cmd, dry_run: false) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/schema_dev/matrix_executor.rb', line 11 def run(cmd, dry_run: false) @errors = [] @matrix.each_with_index do |tuple, i| ruby = tuple[:ruby] activerecord = tuple[:activerecord] db = tuple[:db] label = "ruby #{ruby} - activerecord #{activerecord} - db #{db}" msg = "#{label} [#{i+1} of #{@matrix.size}]" puts "\n\n*** #{msg}\n\n" if not Executor.new(ruby: ruby, activerecord: activerecord, db: db).run(cmd, dry_run: dry_run) @errors << label end end return @errors.empty? end |