Module: Plushie::Type::Alignment

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

Overview

Alignment values for align_x and align_y widget props.

Horizontal: :left, :center, :right (aliases: :start = :left, :end = :right) Vertical: :top, :center, :bottom (aliases: :start = :top, :end = :bottom)

Examples:

column(align_x: :center)
text("hello", align_x: :right)

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 alignment values.

i[left center right top bottom start end].freeze

Class Method Summary collapse

Class Method Details

.encode(value) ⇒ String

Encode an alignment value to the wire format.

Parameters:

  • value (Symbol)

    :left, :center, :right, :top, :bottom, :start, :end

Returns:

  • (String)

Raises:

  • (ArgumentError)


23
24
25
26
# File 'lib/plushie/type/alignment.rb', line 23

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