Class: PartialKs::Runner
- Inherits:
-
Object
- Object
- PartialKs::Runner
- Defined in:
- lib/partial_ks/runner.rb
Instance Attribute Summary collapse
-
#table_graphs ⇒ Object
readonly
Returns the value of attribute table_graphs.
Instance Method Summary collapse
- #each_generation ⇒ Object
-
#initialize(table_graphs) ⇒ Runner
constructor
A new instance of Runner.
- #report ⇒ Object
- #run! ⇒ Object
Constructor Details
#initialize(table_graphs) ⇒ Runner
Returns a new instance of Runner.
5 6 7 |
# File 'lib/partial_ks/runner.rb', line 5 def initialize(table_graphs) @table_graphs = table_graphs end |
Instance Attribute Details
#table_graphs ⇒ Object (readonly)
Returns the value of attribute table_graphs.
3 4 5 |
# File 'lib/partial_ks/runner.rb', line 3 def table_graphs @table_graphs end |
Instance Method Details
#each_generation ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/partial_ks/runner.rb', line 38 def each_generation return enum_for(:each_generation) unless block_given? generations.each do |generation| yield generation end end |
#report ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/partial_ks/runner.rb', line 28 def report result = [] each_generation.with_index do |generation, depth| generation.each do |table| result << [table.table_name, table.parent_model, table.custom_filter_relation, depth] end end result end |
#run! ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/partial_ks/runner.rb', line 9 def run! each_generation do |generation| tables_to_filter = {} table_names = [] generation.each do |table| table_names << table.table_name filter_config = table.kitchen_sync_filter if !filter_config.nil? tables_to_filter[table.table_name] = filter_config end end # TODO output only tables_to_filter, depending on how KS handles filters yield tables_to_filter, table_names end end |