Class: Associo::AttachmentProxy
- Inherits:
-
Object
- Object
- Associo::AttachmentProxy
show all
- Defined in:
- lib/associo/attachment_proxy.rb
Overview
Proxy for the Attached file.
Instance Method Summary
collapse
Constructor Details
Returns a new instance of AttachmentProxy.
4
5
6
7
|
# File 'lib/associo/attachment_proxy.rb', line 4
def initialize(instance, name)
@instance = instance
@name = name
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
39
40
41
42
43
44
45
|
# File 'lib/associo/attachment_proxy.rb', line 39
def method_missing(method, *args, &block)
if grid_io.respond_to? method.to_s
grid_io.send(method, *args, &block)
else
super
end
end
|
Instance Method Details
#chunk_size ⇒ Object
25
26
27
|
# File 'lib/associo/attachment_proxy.rb', line 25
def chunk_size
@instance.send "#{@name}_chunk_size"
end
|
#grid_io ⇒ Object
35
36
37
|
# File 'lib/associo/attachment_proxy.rb', line 35
def grid_io
@grid_io ||= @instance.grid.get(id)
end
|
#id ⇒ Object
9
10
11
|
# File 'lib/associo/attachment_proxy.rb', line 9
def id
@instance.send "#{@name}_id"
end
|
#name ⇒ Object
13
14
15
|
# File 'lib/associo/attachment_proxy.rb', line 13
def name
@instance.send "#{@name}_name"
end
|
#nil? ⇒ Boolean
Also known as:
blank?
29
30
31
|
# File 'lib/associo/attachment_proxy.rb', line 29
def nil?
!@instance.send("#{@name}?")
end
|
#respond_to_missing?(method, include_private = false) ⇒ Boolean
47
48
49
|
# File 'lib/associo/attachment_proxy.rb', line 47
def respond_to_missing?(method, include_private = false)
super
end
|
#size ⇒ Object
17
18
19
|
# File 'lib/associo/attachment_proxy.rb', line 17
def size
@instance.send "#{@name}_size"
end
|
#type ⇒ Object
21
22
23
|
# File 'lib/associo/attachment_proxy.rb', line 21
def type
@instance.send "#{@name}_type"
end
|