Class: ROM::SQL::Plugin::Associates::AssociateOptions Private

Inherits:
Object
  • Object
show all
Defined in:
lib/rom/sql/plugin/associates.rb

Overview

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.

API:

  • private

Instance Attribute Summary collapse

Instance Method Summary collapse

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.

API:

  • private



20
21
22
23
24
25
# File 'lib/rom/sql/plugin/associates.rb', line 20

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

#assocObject (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.

API:

  • private



15
16
17
# File 'lib/rom/sql/plugin/associates.rb', line 15

def assoc
  @assoc
end

#nameObject (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.

API:

  • private



13
14
15
# File 'lib/rom/sql/plugin/associates.rb', line 13

def name
  @name
end

#optsObject (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.

API:

  • private



17
18
19
# File 'lib/rom/sql/plugin/associates.rb', line 17

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.

Returns:

API:

  • private



27
28
29
# File 'lib/rom/sql/plugin/associates.rb', line 27

def after?
  assoc.is_a?(SQL::Associations::ManyToMany)
end

#to_hashObject

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.

API:

  • private



31
32
33
# File 'lib/rom/sql/plugin/associates.rb', line 31

def to_hash
  { associate: opts }
end