Class: TableSaw::DependencyGraph::AddDirective
- Inherits:
-
Object
- Object
- TableSaw::DependencyGraph::AddDirective
- Defined in:
- lib/table_saw/dependency_graph/add_directive.rb
Instance Attribute Summary collapse
-
#has_many ⇒ Object
readonly
Returns the value of attribute has_many.
-
#ids ⇒ Object
Returns the value of attribute ids.
-
#partial ⇒ Object
(also: #partial?)
readonly
Returns the value of attribute partial.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
Instance Method Summary collapse
-
#initialize(table_name, ids: [], partial: true, has_many: {}) ⇒ AddDirective
constructor
A new instance of AddDirective.
- #primary_key ⇒ Object
- #queryable? ⇒ Boolean
- #selectable? ⇒ Boolean
Constructor Details
#initialize(table_name, ids: [], partial: true, has_many: {}) ⇒ AddDirective
Returns a new instance of AddDirective.
9 10 11 12 13 14 |
# File 'lib/table_saw/dependency_graph/add_directive.rb', line 9 def initialize(table_name, ids: [], partial: true, has_many: {}) @table_name = table_name @ids = ids @partial = partial @has_many = has_many end |
Instance Attribute Details
#has_many ⇒ Object (readonly)
Returns the value of attribute has_many.
6 7 8 |
# File 'lib/table_saw/dependency_graph/add_directive.rb', line 6 def has_many @has_many end |
#ids ⇒ Object
Returns the value of attribute ids.
7 8 9 |
# File 'lib/table_saw/dependency_graph/add_directive.rb', line 7 def ids @ids end |
#partial ⇒ Object (readonly) Also known as: partial?
Returns the value of attribute partial.
6 7 8 |
# File 'lib/table_saw/dependency_graph/add_directive.rb', line 6 def partial @partial end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
6 7 8 |
# File 'lib/table_saw/dependency_graph/add_directive.rb', line 6 def table_name @table_name end |
Instance Method Details
#primary_key ⇒ Object
26 27 28 |
# File 'lib/table_saw/dependency_graph/add_directive.rb', line 26 def primary_key TableSaw.schema_cache.primary_keys(table_name) end |
#queryable? ⇒ Boolean
22 23 24 |
# File 'lib/table_saw/dependency_graph/add_directive.rb', line 22 def queryable? !partial || selectable? end |
#selectable? ⇒ Boolean
18 19 20 |
# File 'lib/table_saw/dependency_graph/add_directive.rb', line 18 def selectable? partial? && Array(ids).size.positive? end |