Class: ROM::Associations::ThroughIdentifier Private

Inherits:
Object
  • Object
show all
Defined in:
lib/rom/associations/through_identifier.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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, target, assoc_name) ⇒ ThroughIdentifier

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 ThroughIdentifier.



29
30
31
32
33
# File 'lib/rom/associations/through_identifier.rb', line 29

def initialize(source, target, assoc_name)
  @source = source
  @target = target
  @assoc_name = assoc_name
end

Instance Attribute Details

#assoc_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.



16
17
18
# File 'lib/rom/associations/through_identifier.rb', line 16

def assoc_name
  @assoc_name
end

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



10
11
12
# File 'lib/rom/associations/through_identifier.rb', line 10

def source
  @source
end

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



13
14
15
# File 'lib/rom/associations/through_identifier.rb', line 13

def target
  @target
end

Class Method Details

.[](source, target, assoc_name = nil, inflector: Inflector) ⇒ 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.



19
20
21
# File 'lib/rom/associations/through_identifier.rb', line 19

def self.[](source, target, assoc_name = nil, inflector: Inflector)
  new(source, target, assoc_name || default_assoc_name(target, inflector: inflector))
end

.default_assoc_name(relation, inflector:) ⇒ 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.



24
25
26
# File 'lib/rom/associations/through_identifier.rb', line 24

def self.default_assoc_name(relation, inflector:)
  inflector.singularize(relation).to_sym
end

Instance Method Details

#to_symObject

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.



36
37
38
# File 'lib/rom/associations/through_identifier.rb', line 36

def to_sym
  source
end