Class: Playwright::PlaywrightApi::ApiImplementationWrapper

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

Instance Method Summary collapse

Constructor Details

#initialize(impl) ⇒ ApiImplementationWrapper

Returns a new instance of ApiImplementationWrapper.



63
64
65
66
67
68
69
70
# File 'lib/playwright/playwright_api.rb', line 63

def initialize(impl)
  impl_class_name = impl.class.name
  unless impl_class_name.end_with?("Impl")
    raise "#{impl_class_name} is not Impl"
  end

  @impl = impl
end

Instance Method Details

#wrapObject



72
73
74
75
76
77
78
79
# File 'lib/playwright/playwright_api.rb', line 72

def wrap
  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