Class: Plushie::Type::A11y::Spec

Inherits:
Data
  • Object
show all
Defined in:
lib/plushie/type/a11y.rb,
sig/plushie/type/a11y.rbs

Overview

Immutable spec; use #with to create modified copies.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**fields) ⇒ Spec

Returns a new instance of Spec.

Parameters:

  • (Object)


42
43
44
45
# File 'lib/plushie/type/a11y.rb', line 42

def initialize(**fields)
  defaults = FIELD_KEYS.each_with_object({}) { |k, h| h[k] = nil }
  super(**defaults.merge(fields))
end

Instance Attribute Details

#busyBoolean? (readonly)

Returns the value of attribute busy.

Returns:

  • (Boolean, nil)


16
17
18
# File 'sig/plushie/type/a11y.rbs', line 16

def busy
  @busy
end

#described_byString? (readonly)

Returns the value of attribute described_by.

Returns:

  • (String, nil)


26
27
28
# File 'sig/plushie/type/a11y.rbs', line 26

def described_by
  @described_by
end

#descriptionString? (readonly)

Returns the value of attribute description.

Returns:

  • (String, nil)


10
11
12
# File 'sig/plushie/type/a11y.rbs', line 10

def description
  @description
end

#disabledBoolean? (readonly)

Returns the value of attribute disabled.

Returns:

  • (Boolean, nil)


28
29
30
# File 'sig/plushie/type/a11y.rbs', line 28

def disabled
  @disabled
end

#error_messageString? (readonly)

Returns the value of attribute error_message.

Returns:

  • (String, nil)


27
28
29
# File 'sig/plushie/type/a11y.rbs', line 27

def error_message
  @error_message
end

#expandedBoolean? (readonly)

Returns the value of attribute expanded.

Returns:

  • (Boolean, nil)


12
13
14
# File 'sig/plushie/type/a11y.rbs', line 12

def expanded
  @expanded
end

#has_popupString? (readonly)

Returns the value of attribute has_popup.

Returns:

  • (String, nil)


31
32
33
# File 'sig/plushie/type/a11y.rbs', line 31

def has_popup
  @has_popup
end

#hiddenBoolean? (readonly)

Returns the value of attribute hidden.

Returns:

  • (Boolean, nil)


11
12
13
# File 'sig/plushie/type/a11y.rbs', line 11

def hidden
  @hidden
end

#invalidBoolean? (readonly)

Returns the value of attribute invalid.

Returns:

  • (Boolean, nil)


17
18
19
# File 'sig/plushie/type/a11y.rbs', line 17

def invalid
  @invalid
end

#labelString? (readonly)

Returns the value of attribute label.

Returns:

  • (String, nil)


9
10
11
# File 'sig/plushie/type/a11y.rbs', line 9

def label
  @label
end

#labelled_byString? (readonly)

Returns the value of attribute labelled_by.

Returns:

  • (String, nil)


25
26
27
# File 'sig/plushie/type/a11y.rbs', line 25

def labelled_by
  @labelled_by
end

#levelInteger? (readonly)

Returns the value of attribute level.

Returns:

  • (Integer, nil)


14
15
16
# File 'sig/plushie/type/a11y.rbs', line 14

def level
  @level
end

#liveString? (readonly)

Returns the value of attribute live.

Returns:

  • (String, nil)


15
16
17
# File 'sig/plushie/type/a11y.rbs', line 15

def live
  @live
end

#mnemonicString? (readonly)

Returns the value of attribute mnemonic.

Returns:

  • (String, nil)


20
21
22
# File 'sig/plushie/type/a11y.rbs', line 20

def mnemonic
  @mnemonic
end

Returns the value of attribute modal.

Returns:

  • (Boolean, nil)


18
19
20
# File 'sig/plushie/type/a11y.rbs', line 18

def modal
  @modal
end

#orientationString? (readonly)

Returns the value of attribute orientation.

Returns:

  • (String, nil)


24
25
26
# File 'sig/plushie/type/a11y.rbs', line 24

def orientation
  @orientation
end

#position_in_setInteger? (readonly)

Returns the value of attribute position_in_set.

Returns:

  • (Integer, nil)


29
30
31
# File 'sig/plushie/type/a11y.rbs', line 29

def position_in_set
  @position_in_set
end

#read_onlyBoolean? (readonly)

Returns the value of attribute read_only.

Returns:

  • (Boolean, nil)


19
20
21
# File 'sig/plushie/type/a11y.rbs', line 19

def read_only
  @read_only
end

#requiredBoolean? (readonly)

Returns the value of attribute required.

Returns:

  • (Boolean, nil)


13
14
15
# File 'sig/plushie/type/a11y.rbs', line 13

def required
  @required
end

#roleSymbol? (readonly)

Returns the value of attribute role.

Returns:

  • (Symbol, nil)


8
9
10
# File 'sig/plushie/type/a11y.rbs', line 8

def role
  @role
end

#selectedBoolean? (readonly)

Returns the value of attribute selected.

Returns:

  • (Boolean, nil)


22
23
24
# File 'sig/plushie/type/a11y.rbs', line 22

def selected
  @selected
end

#size_of_setInteger? (readonly)

Returns the value of attribute size_of_set.

Returns:

  • (Integer, nil)


30
31
32
# File 'sig/plushie/type/a11y.rbs', line 30

def size_of_set
  @size_of_set
end

#toggledBoolean? (readonly)

Returns the value of attribute toggled.

Returns:

  • (Boolean, nil)


21
22
23
# File 'sig/plushie/type/a11y.rbs', line 21

def toggled
  @toggled
end

#valueString? (readonly)

Returns the value of attribute value.

Returns:

  • (String, nil)


23
24
25
# File 'sig/plushie/type/a11y.rbs', line 23

def value
  @value
end

Instance Method Details

#to_wireHash

Returns wire-ready map with nil fields stripped.

Returns:

  • (Hash)

    wire-ready map with nil fields stripped



53
54
55
# File 'lib/plushie/type/a11y.rb', line 53

def to_wire
  to_h.compact
end

#with(**changes) ⇒ Spec

Returns a copy with the given fields updated.

Parameters:

  • (Object)

Returns:



48
49
50
# File 'lib/plushie/type/a11y.rb', line 48

def with(**changes)
  self.class.new(**to_h.merge(changes))
end