Class: HakumiComponents::SelectionControl::Option

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
Entry
Defined in:
app/components/hakumi_components/selection_control/option.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, value:) ⇒ Option

Returns a new instance of Option.



12
13
14
15
# File 'app/components/hakumi_components/selection_control/option.rb', line 12

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

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



28
29
30
# File 'app/components/hakumi_components/selection_control/option.rb', line 28

def label
  @label
end

#valueObject (readonly)

Returns the value of attribute value.



31
32
33
# File 'app/components/hakumi_components/selection_control/option.rb', line 31

def value
  @value
end

Instance Method Details

#group?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'app/components/hakumi_components/selection_control/option.rb', line 23

def group?
  false
end

#option?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/components/hakumi_components/selection_control/option.rb', line 18

def option?
  true
end

#to_hObject



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

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