class Playwright::ChannelOwner
Attributes
_api[RW]
hidden field for caching API instance.
channel[R]
Public Class Methods
from(channel)
click to toggle source
# File lib/playwright/channel_owner.rb, line 5 def self.from(channel) channel.object end
from_nullable(channel)
click to toggle source
# File lib/playwright/channel_owner.rb, line 9 def self.from_nullable(channel) channel&.object end
new(parent, type, guid, initializer)
click to toggle source
@param parent [Playwright::ChannelOwner|Playwright::Connection] @param type [String] @param guid [String] @param initializer [Hash]
# File lib/playwright/channel_owner.rb, line 20 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
Public Instance Methods
inspect()
click to toggle source
Suppress long long inspect log and avoid RSpec from hanging up…
# File lib/playwright/channel_owner.rb, line 57 def inspect to_s end
to_s()
click to toggle source
# File lib/playwright/channel_owner.rb, line 61 def to_s "#<#{@guid}>" end
Private Instance Methods
after_initialize()
click to toggle source
# File lib/playwright/channel_owner.rb, line 65 def after_initialize end
delete_object_from_child(guid)
click to toggle source
# File lib/playwright/channel_owner.rb, line 72 def delete_object_from_child(guid) @objects.delete(guid) end
dispose!()
click to toggle source
used only from Connection
. Not intended for public use. So keep private.
# File lib/playwright/channel_owner.rb, line 46 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 { |object| object.send(:dispose!) } @objects.clear end
update_object_from_child(guid, child)
click to toggle source
# File lib/playwright/channel_owner.rb, line 68 def update_object_from_child(guid, child) @objects[guid] = child end