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.



27
28
29
30
31
# File 'lib/rom/associations/through_identifier.rb', line 27

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.



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

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.



8
9
10
# File 'lib/rom/associations/through_identifier.rb', line 8

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.



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

def target
  @target
end

Class Method Details

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



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

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

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



22
23
24
# File 'lib/rom/associations/through_identifier.rb', line 22

def self.default_assoc_name(relation)
  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.



34
35
36
# File 'lib/rom/associations/through_identifier.rb', line 34

def to_sym
  source
end