Class: Locomotive::Steam::Models::ReferencedAssociation
- Inherits:
-
Object
- Object
- Locomotive::Steam::Models::ReferencedAssociation
show all
- Defined in:
- lib/locomotive/steam/models/associations/referenced.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(repository_klass, scope, adapter, options = {}, &block) ⇒ ReferencedAssociation
Returns a new instance of ReferencedAssociation.
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/locomotive/steam/models/associations/referenced.rb', line 8
def initialize(repository_klass, scope, adapter, options = {}, &block)
@repository = repository_klass.new(adapter)
@repository.scope = scope.dup
@block = block_given? ? block : nil
@options = options
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
47
48
49
50
51
|
# File 'lib/locomotive/steam/models/associations/referenced.rb', line 47
def method_missing(name, *args, &block)
__call_block_once__
__load__.try(:send, name, *args, &block)
end
|
Instance Attribute Details
#repository ⇒ Object
Returns the value of attribute repository.
6
7
8
|
# File 'lib/locomotive/steam/models/associations/referenced.rb', line 6
def repository
@repository
end
|
Instance Method Details
#__attach__(entity) ⇒ Object
26
27
28
|
# File 'lib/locomotive/steam/models/associations/referenced.rb', line 26
def __attach__(entity)
@entity = entity
end
|
#__call_block_once__ ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/locomotive/steam/models/associations/referenced.rb', line 38
def __call_block_once__
if @block
@block.call(@repository, @options)
@block = nil end
end
|
#__load__ ⇒ Object
30
31
32
|
# File 'lib/locomotive/steam/models/associations/referenced.rb', line 30
def __load__
end
|
#__name__ ⇒ Object
22
23
24
|
# File 'lib/locomotive/steam/models/associations/referenced.rb', line 22
def __name__
@options[:association_name]
end
|
#__serialize__(entity) ⇒ Object
34
35
36
|
# File 'lib/locomotive/steam/models/associations/referenced.rb', line 34
def __serialize__(entity)
end
|