Class: Imagekitio::Models::ResponsiveImageAttributes

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/imagekitio/models/responsive_image_attributes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(src: , sizes: nil, src_set: nil, width: nil) ⇒ Object

Some parameter documentations has been truncated, see Imagekitio::Models::ResponsiveImageAttributes for more details.

Resulting set of attributes suitable for an HTML ‘<img>` element. Useful for enabling responsive image loading with `srcSet` and `sizes`.

Parameters:

  • src (String) (defaults to: )

    URL for the largest candidate (assigned to plain ‘src`).

  • sizes (String) (defaults to: nil)

    ‘sizes` returned (or synthesised as `100vw`).

  • src_set (String) (defaults to: nil)

    Candidate set with ‘w` or `x` descriptors.

  • width (Float) (defaults to: nil)

    Width as a number (if ‘width` was provided in the input options).



# File 'lib/imagekitio/models/responsive_image_attributes.rb', line 32


Instance Attribute Details

#sizesString?

‘sizes` returned (or synthesised as `100vw`). The value for the HTML `sizes` attribute.

Returns:

  • (String, nil)


17
# File 'lib/imagekitio/models/responsive_image_attributes.rb', line 17

optional :sizes, String

#srcString

URL for the largest candidate (assigned to plain ‘src`).

Returns:

  • (String)


10
# File 'lib/imagekitio/models/responsive_image_attributes.rb', line 10

required :src, String

#src_setString?

Candidate set with ‘w` or `x` descriptors. Multiple image URLs separated by commas, each with a descriptor.

Returns:

  • (String, nil)


24
# File 'lib/imagekitio/models/responsive_image_attributes.rb', line 24

optional :src_set, String, api_name: :srcSet

#widthFloat?

Width as a number (if ‘width` was provided in the input options).

Returns:

  • (Float, nil)


30
# File 'lib/imagekitio/models/responsive_image_attributes.rb', line 30

optional :width, Float