Class: Proxify::Proxy
- Inherits:
-
Object
- Object
- Proxify::Proxy
- Defined in:
- lib/proxify/proxify.rb
Instance Attribute Summary collapse
-
#proxies ⇒ Object
readonly
Returns the value of attribute proxies.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
-
#initialize(subject, proxies) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(subject, proxies) ⇒ Proxy
Returns a new instance of Proxy.
7 8 9 10 |
# File 'lib/proxify/proxify.rb', line 7 def initialize(subject, proxies) @subject = subject @proxies = proxies end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/proxify/proxify.rb', line 12 def method_missing(method, *args, &block) if proxies.include?(method) return subject.send(method, *args, &block) else raise NoMethodError, method.to_s end end |
Instance Attribute Details
#proxies ⇒ Object (readonly)
Returns the value of attribute proxies.
5 6 7 |
# File 'lib/proxify/proxify.rb', line 5 def proxies @proxies end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
5 6 7 |
# File 'lib/proxify/proxify.rb', line 5 def subject @subject end |