Class: Stubborn::ProxyForModule
- Inherits:
-
ProxyForInstance
- Object
- ProxyForInstance
- Stubborn::ProxyForModule
- Defined in:
- lib/stubborn/proxy_for_module.rb
Instance Method Summary collapse
-
#initialize(proxy_target, options = {}) ⇒ ProxyForModule
constructor
A new instance of ProxyForModule.
- #name ⇒ Object
- #new(*args, &block) ⇒ Object
Methods inherited from ProxyForInstance
Constructor Details
#initialize(proxy_target, options = {}) ⇒ ProxyForModule
Returns a new instance of ProxyForModule.
3 4 5 6 |
# File 'lib/stubborn/proxy_for_module.rb', line 3 def initialize(proxy_target, = {}) super redefine_const(proxy_target, self) unless proxy_target.name.strip.empty? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Stubborn::ProxyForInstance
Instance Method Details
#name ⇒ Object
8 9 10 |
# File 'lib/stubborn/proxy_for_module.rb', line 8 def name @proxy_target.name end |
#new(*args, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/stubborn/proxy_for_module.rb', line 12 def new(*args, &block) new_instance = @proxy_target.new(*args, &block) raise_missed_stub_exception("new", args, new_instance) if @only_methods.include?("new") && !@methods_to_skip.include?("new") = {:class => self} if @instance_methods [:only] = @instance_methods[:only] [:except] = @instance_methods[:except] end ProxyForInstance.new(new_instance, ) end |