Module: Playwright::ScreenshotUtils
- Defined in:
- lib/playwright/screenshot_utils.rb
Class Method Summary collapse
Class Method Details
.determine_type(path:, type:) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/playwright/screenshot_utils.rb', line 7 def determine_type(path:, type:) return type if type return nil unless path mime_type = MIME::Types.type_for(path).first case mime_type&.content_type when 'image/png' 'png' when 'image/jpeg' 'jpeg' when 'image/webp' 'webp' else raise ArgumentError.new("path: unsupported mime type \"#{mime_type}\"") end end |