Class: TableSaw::DependencyGraph::HasManyDirectives

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, 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(context, directive)
  @context = context
  @directive = directive
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



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

def context
  @context
end

#directiveObject (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

Instance Method Details

#callObject



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

def call
  valid_associations.map do |table, column|
    TableSaw::DependencyGraph::AddDirective.new(
      table, ids: query_result(table, column).map { |r| r['id'] }, partial: directive.partial?
    )
  end
end