Class: TableSaw::DependencyGraph::HasManyDirectives
- Inherits:
-
Object
- Object
- TableSaw::DependencyGraph::HasManyDirectives
- Defined in:
- lib/table_saw/dependency_graph/has_many_directives.rb
Instance Attribute Summary collapse
-
#directive ⇒ Object
readonly
Returns the value of attribute directive.
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(manifest, directive) ⇒ HasManyDirectives
constructor
A new instance of HasManyDirectives.
Constructor Details
#initialize(manifest, directive) ⇒ HasManyDirectives
Returns a new instance of HasManyDirectives.
8 9 10 11 |
# File 'lib/table_saw/dependency_graph/has_many_directives.rb', line 8 def initialize(manifest, directive) @manifest = manifest @directive = directive end |
Instance Attribute Details
#directive ⇒ Object (readonly)
Returns the value of attribute directive.
6 7 8 |
# File 'lib/table_saw/dependency_graph/has_many_directives.rb', line 6 def directive @directive end |
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
6 7 8 |
# File 'lib/table_saw/dependency_graph/has_many_directives.rb', line 6 def manifest @manifest end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/table_saw/dependency_graph/has_many_directives.rb', line 13 def call valid_associations.map do |fk| TableSaw::DependencyGraph::AddDirective.new( fk.from_table, ids: query_result(fk).map { |r| r[TableSaw.schema_cache.primary_keys(fk.from_table)] }, partial: directive.partial? ) end end |