Class: OnyxCord::Webhooks::Modal::GroupBuilder
- Inherits:
-
Object
- Object
- OnyxCord::Webhooks::Modal::GroupBuilder
- Defined in:
- lib/onyxcord/webhooks/modal/group_builder.rb
Instance Method Summary collapse
-
#checkbox(value:, label:, description: nil, default: nil) ⇒ Object
Add a checkbox component to the group.
-
#radio_button(value:, label:, description: nil, default: nil) ⇒ Object
(also: #button)
Add a radio button component to the group.
Instance Method Details
#checkbox(value:, label:, description: nil, default: nil) ⇒ Object
Add a checkbox component to the group.
21 22 23 24 25 |
# File 'lib/onyxcord/webhooks/modal/group_builder.rb', line 21 def checkbox(value:, label:, description: nil, default: nil) raise "Cannot add a checkbox to a #{@type}" unless @type == :checkbox_group @options << { value: value, label: label, description: description, default: default }.compact end |
#radio_button(value:, label:, description: nil, default: nil) ⇒ Object Also known as:
Add a radio button component to the group.
32 33 34 35 36 |
# File 'lib/onyxcord/webhooks/modal/group_builder.rb', line 32 def (value:, label:, description: nil, default: nil) raise "Cannot add a radio button to a #{@type}" unless @type == :radio_group @options << { value: value, label: label, description: description, default: default }.compact end |