Class: Kreuzberg::ImageMetadata

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/kreuzberg/types.rb

Overview

Image metadata

Represents an image element found in the HTML document

Examples:

image = Kreuzberg::ImageMetadata.new(
  src: "images/logo.png",
  alt: "Company Logo",
  title: nil,
  dimensions: [200, 100],
  image_type: "png",
  attributes: { "loading" => "lazy" }
)
if image.dimensions
  width, height = image.dimensions
  puts "#{width}x#{height}"
end