Class: TableSaw::DependencyGraph::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/table_saw/dependency_graph/build.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(manifest) ⇒ Build

Returns a new instance of Build.



8
9
10
11
# File 'lib/table_saw/dependency_graph/build.rb', line 8

def initialize(manifest)
  @manifest = manifest
  @records = {}
end

Instance Attribute Details

#manifestObject (readonly)

Returns the value of attribute manifest.



6
7
8
# File 'lib/table_saw/dependency_graph/build.rb', line 6

def manifest
  @manifest
end

#recordsObject (readonly)

Returns the value of attribute records.



6
7
8
# File 'lib/table_saw/dependency_graph/build.rb', line 6

def records
  @records
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
# File 'lib/table_saw/dependency_graph/build.rb', line 13

def call
  manifest.tables.values.sort_by { |t| t.partial? ? 1 : 0 }.each do |table|
    add TableSaw::DependencyGraph::AddDirective.new(table.name, ids: select_ids(table), partial: table.partial?,
                                                                has_many: table.has_many)
  end

  records
end