Class: ROM::SQL::Plugin::Associates::AssociateOptions Private
- Inherits:
-
Object
- Object
- ROM::SQL::Plugin::Associates::AssociateOptions
- Defined in:
- lib/rom/sql/plugin/associates.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #assoc ⇒ Object readonly private
- #name ⇒ Object readonly private
- #opts ⇒ Object readonly private
Instance Method Summary collapse
- #after? ⇒ Boolean private
-
#initialize(name, relation, opts) ⇒ AssociateOptions
constructor
private
A new instance of AssociateOptions.
- #to_hash ⇒ Object private
Constructor Details
#initialize(name, relation, opts) ⇒ AssociateOptions
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of AssociateOptions.
14 15 16 17 18 19 |
# File 'lib/rom/sql/plugin/associates.rb', line 14 def initialize(name, relation, opts) @name = name @assoc = relation.associations[name] @opts = { assoc: assoc, keys: assoc.join_keys } @opts.update(parent: opts[:parent]) if opts[:parent] end |
Instance Attribute Details
#assoc ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/rom/sql/plugin/associates.rb', line 11 def assoc @assoc end |
#name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/rom/sql/plugin/associates.rb', line 11 def name @name end |
#opts ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/rom/sql/plugin/associates.rb', line 11 def opts @opts end |
Instance Method Details
#after? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/rom/sql/plugin/associates.rb', line 21 def after? assoc.is_a?(SQL::Associations::ManyToMany) end |
#to_hash ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/rom/sql/plugin/associates.rb', line 25 def to_hash { associate: opts } end |