class Slack::BlockKit::Element::RadioButtons
A radio button group that allows a user to choose one item from a list of possible options.
Constants
- TYPE
Attributes
options[RW]
Public Class Methods
new(action_id:) { |self| ... }
click to toggle source
# File lib/slack/block_kit/element/radio_buttons.rb, line 16 def initialize(action_id:) @action_id = action_id @options = [] yield(self) if block_given? end
Public Instance Methods
as_json(*)
click to toggle source
# File lib/slack/block_kit/element/radio_buttons.rb, line 35 def as_json(*) { type: TYPE, action_id: @action_id, options: @options.map(&:as_json), initial_option: initial_option&.as_json, confirm: confirm&.as_json }.compact end
option(value:, text:, initial: false)
click to toggle source
# File lib/slack/block_kit/element/radio_buttons.rb, line 23 def option(value:, text:, initial: false) option = Composition::Option.new( value: value, text: text, initial: initial ) @options << option self end
Private Instance Methods
initial_option()
click to toggle source
# File lib/slack/block_kit/element/radio_buttons.rb, line 47 def initial_option @options&.find(&:initial?) end