Sha256: aea2b989222f2adc8f0b261512d2aeab6eded26a50ec6e63cd931047bf6517c3
Contents?: true
Size: 890 Bytes
Versions: 14
Compression:
Stored size: 890 Bytes
Contents
# frozen_string_literal: true module Slack module BlockKit module Composition # Provides a way to group options in a select menu. # # https://api.slack.com/reference/messaging/composition-objects#option-group # https://api.slack.com/reference/messaging/block-elements#select class OptionGroup attr_accessor :options def initialize(label:, emoji: nil) @label = PlainText.new(text: label, emoji: emoji) @options = [] yield(self) if block_given? end def option(text:, value:, emoji: nil, initial: false) @options << Option.new(text: text, value: value, emoji: emoji, initial: initial) self end def as_json(*) { label: @label.as_json, options: @options.map(&:as_json) } end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems