Class: TableSaw::DependencyGraph::BuildHasManyQuery
- Inherits:
-
Object
- Object
- TableSaw::DependencyGraph::BuildHasManyQuery
- Defined in:
- lib/table_saw/dependency_graph/build_has_many_query.rb
Constant Summary collapse
- QUERY =
<<~SQL.squish select %{primary_key} from %{table} where %{clause} and %{polymorphic} SQL
Instance Attribute Summary collapse
-
#directive ⇒ Object
readonly
Returns the value of attribute directive.
-
#foreign_key ⇒ Object
readonly
Returns the value of attribute foreign_key.
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(manifest, directive, foreign_key) ⇒ BuildHasManyQuery
constructor
A new instance of BuildHasManyQuery.
Constructor Details
#initialize(manifest, directive, foreign_key) ⇒ BuildHasManyQuery
Returns a new instance of BuildHasManyQuery.
12 13 14 15 16 |
# File 'lib/table_saw/dependency_graph/build_has_many_query.rb', line 12 def initialize(manifest, directive, foreign_key) @manifest = manifest @directive = directive @foreign_key = foreign_key end |
Instance Attribute Details
#directive ⇒ Object (readonly)
Returns the value of attribute directive.
10 11 12 |
# File 'lib/table_saw/dependency_graph/build_has_many_query.rb', line 10 def directive @directive end |
#foreign_key ⇒ Object (readonly)
Returns the value of attribute foreign_key.
10 11 12 |
# File 'lib/table_saw/dependency_graph/build_has_many_query.rb', line 10 def foreign_key @foreign_key end |
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
10 11 12 |
# File 'lib/table_saw/dependency_graph/build_has_many_query.rb', line 10 def manifest @manifest end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 |
# File 'lib/table_saw/dependency_graph/build_has_many_query.rb', line 18 def call build_base_query .then { |query| append_scope(query) } .then { |query| append_limit(query) } end |