Class: Playwright::PlaywrightApi::Factory
- Inherits:
-
Object
- Object
- Playwright::PlaywrightApi::Factory
- Defined in:
- lib/playwright/playwright_api.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(channel_owner) ⇒ Factory
constructor
A new instance of Factory.
Constructor Details
#initialize(channel_owner) ⇒ Factory
Returns a new instance of Factory.
16 17 18 19 20 21 |
# File 'lib/playwright/playwright_api.rb', line 16 def initialize(channel_owner) channel_owner_class_name = channel_owner.class.name raise "#{channel_owner_class_name} is not a channel owner" unless channel_owner_class_name.include?('::ChannelOwners::') @channel_owner = channel_owner end |
Instance Method Details
#create ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/playwright/playwright_api.rb', line 23 def create api_class = detect_class_for(@channel_owner.class) if api_class api_class.new(@channel_owner) else raise NotImplementedError.new("Playwright::#{expected_class_name_for(@channel_owner.class)} is not implemented") end end |