Class: CowProxy::Base
- Inherits:
-
Object
- Object
- CowProxy::Base
- Defined in:
- lib/cow_proxy/base.rb
Overview
Base class to create CowProxy classes
Also, it’s used as default CowProxy class for non-registered classes with copy-on-write disabled, so returned values are wrapped but methods trying to change object still raise exception.
Class Attribute Summary collapse
-
.wrapped_class ⇒ Object
Class which will be wrapped with this CowProxy class.
Class Method Summary collapse
-
.inherited(subclass) ⇒ Object
Setup wrapped_class and register itself into CowProxy with CowProxy.register_proxy.
Instance Method Summary collapse
-
#initialize(obj, parent = nil, parent_var = nil) ⇒ Base
constructor
Creates a CowProxy object wrapping obj.
Constructor Details
#initialize(obj, parent = nil, parent_var = nil) ⇒ Base
Creates a CowProxy object wrapping obj
50 51 52 53 54 55 |
# File 'lib/cow_proxy/base.rb', line 50 def initialize(obj, parent = nil, parent_var = nil) @delegate_dc_obj = obj @parent_proxy = parent @parent_var = parent_var @dc_obj_duplicated = false end |
Class Attribute Details
.wrapped_class ⇒ Object
Class which will be wrapped with this CowProxy class
10 11 12 |
# File 'lib/cow_proxy/base.rb', line 10 def wrapped_class @wrapped_class end |
Class Method Details
.inherited(subclass) ⇒ Object
Setup wrapped_class and register itself into CowProxy with CowProxy.register_proxy
14 15 16 17 |
# File 'lib/cow_proxy/base.rb', line 14 def inherited(subclass) subclass.wrapped_class = wrapped_class CowProxy.register_proxy wrapped_class, subclass if wrapped_class end |