Sha256: 14f0ebfb2b1311732c8b512d51833876e9bf10732fcdceab05ede3fe2a5930e0
Contents?: true
Size: 856 Bytes
Versions: 14
Compression:
Stored size: 856 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) @options << Option.new(text: text, value: value, emoji: emoji) 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 & 2 rubygems