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