Class: Discordrb::Webhooks::Modal::GroupBuilder
- Inherits:
-
Object
- Object
- Discordrb::Webhooks::Modal::GroupBuilder
- Defined in:
- lib/discordrb/webhooks/modal.rb
Overview
Builder for radio and checkbox groups.
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.
40 41 42 43 44 |
# File 'lib/discordrb/webhooks/modal.rb', line 40 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 } end |
#radio_button(value:, label:, description: nil, default: nil) ⇒ Object Also known as:
Add a radio button component to the group.
51 52 53 54 55 |
# File 'lib/discordrb/webhooks/modal.rb', line 51 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 } end |