Class: HakumiComponents::SelectionControl::Option
- Inherits:
-
Object
- Object
- HakumiComponents::SelectionControl::Option
- Extended by:
- T::Sig
- Includes:
- Entry
- Defined in:
- app/components/hakumi_components/selection_control/option.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #group? ⇒ Boolean
-
#initialize(label:, value:) ⇒ Option
constructor
A new instance of Option.
- #option? ⇒ Boolean
- #to_h ⇒ Object
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
#label ⇒ Object (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 |
#value ⇒ Object (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
23 24 25 |
# File 'app/components/hakumi_components/selection_control/option.rb', line 23 def group? false end |
#option? ⇒ Boolean
18 19 20 |
# File 'app/components/hakumi_components/selection_control/option.rb', line 18 def option? true end |
#to_h ⇒ Object
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 |