Class: Playwright::PlaywrightApi

Inherits:
Object
  • Object
show all
Defined in:
lib/playwright/playwright_api.rb

Defined Under Namespace

Classes: ApiImplementationWrapper, ChannelOwnerWrapper

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(impl) ⇒ PlaywrightApi

Returns a new instance of PlaywrightApi.



111
112
113
# File 'lib/playwright/playwright_api.rb', line 111

def initialize(impl)
  @impl = impl
end

Class Method Details

.unwrap(api) ⇒ Object

Note:

Intended for internal use only.

Unwrap ChannelOwner / ApiImplementation.



23
24
25
26
27
28
29
30
# File 'lib/playwright/playwright_api.rb', line 23

def self.unwrap(api)
  case api
  when PlaywrightApi
    api.instance_variable_get(:@impl)
  else
    api
  end
end

.wrap(channel_owner_or_api_implementation) ⇒ Object

Note:

Intended for internal use only.

Wrap ChannelOwner / ApiImplementation. Playwright::ChannelOwners::XXXXX will be wrapped as Playwright::XXXXX Playwright::YYYYImpl will be wrapped as Playwright::YYYY Playwright::XXXXX is automatically generated by development/generate_api

Parameters:



10
11
12
13
14
15
16
17
18
19
# File 'lib/playwright/playwright_api.rb', line 10

def self.wrap(channel_owner_or_api_implementation)
  case channel_owner_or_api_implementation
  when ChannelOwner
    ChannelOwnerWrapper.new(channel_owner_or_api_implementation).wrap
  when ApiImplementation
    ApiImplementationWrapper.new(channel_owner_or_api_implementation).wrap
  else
    channel_owner_or_api_implementation
  end
end