Class: Torque::PostgreSQL::PredicateTable
- Inherits:
-
Object
- Object
- Torque::PostgreSQL::PredicateTable
- Defined in:
- lib/torque/postgresql/predicate_table.rb
Overview
Mimics ActiveRecord::TableMetadata so that the parts of a value that holds other values, like the columns of a composite type or the properties of a document, can be treated as the columns of the value they belong to. That is what allows each of them to be handed back to the predicate builder
The handler is the one that knows how to resolve a name, and the node is the one that knows how to reach it
Instance Method Summary collapse
- #[](name) ⇒ Object
- #aggregated_with? ⇒ Boolean
- #arel_table ⇒ Object
-
#associated_with ⇒ Object
(also: #associated_with?)
Rails 8.1 renamed this, so both names answer for the supported versions.
-
#has_column? ⇒ Boolean
Anything that gets here is meant to be resolved as a part of the value, which is what
type_ofis there to accept or reject. -
#initialize(handler, source, node) ⇒ PredicateTable
constructor
A new instance of PredicateTable.
- #polymorphic_association? ⇒ Boolean
- #primary_key ⇒ Object
- #through_association? ⇒ Boolean
- #type(name) ⇒ Object
Constructor Details
#initialize(handler, source, node) ⇒ PredicateTable
Returns a new instance of PredicateTable.
13 14 15 16 17 |
# File 'lib/torque/postgresql/predicate_table.rb', line 13 def initialize(handler, source, node) @handler = handler @source = source @node = node end |
Instance Method Details
#[](name) ⇒ Object
23 24 25 |
# File 'lib/torque/postgresql/predicate_table.rb', line 23 def [](name) @node.new(@source, name, *@handler.type_of(name)) end |
#aggregated_with? ⇒ Boolean
48 49 50 |
# File 'lib/torque/postgresql/predicate_table.rb', line 48 def aggregated_with?(*) false end |
#arel_table ⇒ Object
19 20 21 |
# File 'lib/torque/postgresql/predicate_table.rb', line 19 def arel_table self end |
#associated_with ⇒ Object Also known as: associated_with?
Rails 8.1 renamed this, so both names answer for the supported versions
42 43 44 |
# File 'lib/torque/postgresql/predicate_table.rb', line 42 def associated_with(*) false end |
#has_column? ⇒ Boolean
Anything that gets here is meant to be resolved as a part of the value,
which is what type_of is there to accept or reject
33 34 35 |
# File 'lib/torque/postgresql/predicate_table.rb', line 33 def has_column?(*) true end |
#polymorphic_association? ⇒ Boolean
52 53 54 |
# File 'lib/torque/postgresql/predicate_table.rb', line 52 def polymorphic_association? false end |
#primary_key ⇒ Object
37 38 39 |
# File 'lib/torque/postgresql/predicate_table.rb', line 37 def primary_key nil end |
#through_association? ⇒ Boolean
56 57 58 |
# File 'lib/torque/postgresql/predicate_table.rb', line 56 def through_association? false end |
#type(name) ⇒ Object
27 28 29 |
# File 'lib/torque/postgresql/predicate_table.rb', line 27 def type(name) @handler.type_of(name).first end |