Class: Eventbox::WrappedObject
- Inherits:
-
Object
- Object
- Eventbox::WrappedObject
- Defined in:
- lib/eventbox/sanitizer.rb
Overview
Generic wrapper for objects that are passed through a foreign scope as reference.
Access to the object from a different scope is denied, but the wrapper object can be stored and passed back to the origin scope to unwrap it.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(object, event_loop, name = nil) ⇒ WrappedObject
constructor
A new instance of WrappedObject.
- #inspect ⇒ Object
- #object_for(target_event_loop) ⇒ Object
Constructor Details
#initialize(object, event_loop, name = nil) ⇒ WrappedObject
Returns a new instance of WrappedObject.
248 249 250 251 252 253 |
# File 'lib/eventbox/sanitizer.rb', line 248 def initialize(object, event_loop, name=nil) @object = object @event_loop = event_loop @name = name @dont_marshal = ExternalSharedObject # protect self from being marshaled end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
247 248 249 |
# File 'lib/eventbox/sanitizer.rb', line 247 def name @name end |
Instance Method Details
#inspect ⇒ Object
259 260 261 |
# File 'lib/eventbox/sanitizer.rb', line 259 def inspect "#<#{self.class} @object=#{@object.inspect} @name=#{@name.inspect}>" end |
#object_for(target_event_loop) ⇒ Object
255 256 257 |
# File 'lib/eventbox/sanitizer.rb', line 255 def object_for(target_event_loop) @event_loop == target_event_loop ? @object : self end |