Module: Plushie::Type::ContentFit

Defined in:
lib/plushie/type/content_fit.rb

Overview

Scaling mode for the content_fit prop on image and SVG widgets.

Examples:

image("photo", "/path/to/img.png", content_fit: :cover)

Constant Summary collapse

VALID =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Valid content fit modes.

%i[contain cover fill none scale_down].freeze

Class Method Summary collapse

Class Method Details

.encode(value) ⇒ String

Parameters:

  • value (Symbol)

    :contain, :cover, :fill, :none, :scale_down

Returns:

  • (String)

Raises:

  • (ArgumentError)


16
17
18
19
# File 'lib/plushie/type/content_fit.rb', line 16

def self.encode(value)
  raise ArgumentError, "invalid content_fit: #{value.inspect}" unless VALID.include?(value)
  value.to_s
end