Class: Playwright::ChannelOwner
- Inherits:
-
Object
- Object
- Playwright::ChannelOwner
- Includes:
- EventEmitter
- Defined in:
- lib/playwright/channel_owner.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
Class Method Summary collapse
Instance Method Summary collapse
- #dispose ⇒ Object
-
#initialize(parent, type, guid, initializer) ⇒ ChannelOwner
constructor
A new instance of ChannelOwner.
Methods included from EventEmitter
Constructor Details
#initialize(parent, type, guid, initializer) ⇒ ChannelOwner
Returns a new instance of ChannelOwner.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/playwright/channel_owner.rb', line 13 def initialize(parent, type, guid, initializer) @objects = {} if parent.is_a?(ChannelOwner) @connection = parent.instance_variable_get(:@connection) @connection.send(:update_object_from_channel_owner, guid, self) @parent = parent @parent.send(:update_object_from_child, guid, self) elsif parent.is_a?(Connection) @connection = parent @connection.send(:update_object_from_channel_owner, guid, self) else raise ArgumentError.new('parent must be an instance of Playwright::ChannelOwner or Playwright::Connection') end @channel = Channel.new(@connection, guid, object: self) @type = type @guid = guid @initializer = initializer after_initialize end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
36 37 38 |
# File 'lib/playwright/channel_owner.rb', line 36 def channel @channel end |
Class Method Details
.from(channel) ⇒ Object
5 6 7 |
# File 'lib/playwright/channel_owner.rb', line 5 def self.from(channel) channel.object end |
Instance Method Details
#dispose ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/playwright/channel_owner.rb', line 38 def dispose # Clean up from parent and connection. @parent&.send(:delete_object_from_child, @guid) @connection.send(:delete_object_from_channel_owner, @guid) # Dispose all children. @objects.each_value(&:dispose) @objects.clear end |