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.



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

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



83
84
85
86
87
88
89
90
# File 'lib/playwright/playwright_api.rb', line 83

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