Class: HakumiComponents::Radio::Group::Option

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
app/components/hakumi_components/radio/group/option.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, value:, disabled: false) ⇒ Option

Returns a new instance of Option.



17
18
19
20
21
# File 'app/components/hakumi_components/radio/group/option.rb', line 17

def initialize(label:, value:, disabled: false)
  @label = label
  @value = value
  @disabled = disabled
end

Instance Attribute Details

#disabledObject (readonly)

Returns the value of attribute disabled.



30
31
32
# File 'app/components/hakumi_components/radio/group/option.rb', line 30

def disabled
  @disabled
end

#labelObject (readonly)

Returns the value of attribute label.



24
25
26
# File 'app/components/hakumi_components/radio/group/option.rb', line 24

def label
  @label
end

#valueObject (readonly)

Returns the value of attribute value.



27
28
29
# File 'app/components/hakumi_components/radio/group/option.rb', line 27

def value
  @value
end

Instance Method Details

#to_hObject



33
34
35
36
37
38
39
# File 'app/components/hakumi_components/radio/group/option.rb', line 33

def to_h
  {
    label: @label,
    value: @value,
    disabled: @disabled
  }
end