Class: ActiveLdap::Association::Proxy
- Inherits:
-
Object
- Object
- ActiveLdap::Association::Proxy
show all
- Defined in:
- lib/active_ldap/association/proxy.rb
Instance Method Summary
collapse
Constructor Details
#initialize(owner, options) ⇒ Proxy
Returns a new instance of Proxy.
7
8
9
10
11
12
|
# File 'lib/active_ldap/association/proxy.rb', line 7
def initialize(owner, options)
@owner = owner
@options = options
extend(options[:extend]) if options[:extend]
reset
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
56
57
58
59
|
# File 'lib/active_ldap/association/proxy.rb', line 56
def method_missing(method, *args, &block)
load_target
@target.send(method, *args, &block)
end
|
Instance Method Details
#===(other) ⇒ Object
19
20
21
|
# File 'lib/active_ldap/association/proxy.rb', line 19
def ===(other)
load_target and other === @target
end
|
#exists? ⇒ Boolean
50
51
52
53
|
# File 'lib/active_ldap/association/proxy.rb', line 50
def exists?
load_target
not @target.nil?
end
|
#loaded ⇒ Object
37
38
39
|
# File 'lib/active_ldap/association/proxy.rb', line 37
def loaded
@loaded = true
end
|
#loaded? ⇒ Boolean
33
34
35
|
# File 'lib/active_ldap/association/proxy.rb', line 33
def loaded?
@loaded
end
|
#proxy_respond_to? ⇒ Object
4
|
# File 'lib/active_ldap/association/proxy.rb', line 4
alias_method :proxy_respond_to?, :respond_to?
|
#reload ⇒ Object
28
29
30
31
|
# File 'lib/active_ldap/association/proxy.rb', line 28
def reload
reset
load_target
end
|
#reset ⇒ Object
23
24
25
26
|
# File 'lib/active_ldap/association/proxy.rb', line 23
def reset
@target = nil
@loaded = false
end
|
#respond_to?(symbol, include_priv = false) ⇒ Boolean
14
15
16
17
|
# File 'lib/active_ldap/association/proxy.rb', line 14
def respond_to?(symbol, include_priv=false)
proxy_respond_to?(symbol, include_priv) or
(load_target && @target.respond_to?(symbol, include_priv))
end
|
#target ⇒ Object
41
42
43
|
# File 'lib/active_ldap/association/proxy.rb', line 41
def target
@target
end
|
#target=(target) ⇒ Object
45
46
47
48
|
# File 'lib/active_ldap/association/proxy.rb', line 45
def target=(target)
@target = target
loaded
end
|