class Slack::BlockKit::Element::MultiExternalSelectElement

Attributes

initial_options[R]
max_selected_items[R]

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/slack/block_kit/element/multi_external_select_element.rb, line 18
def initialize
  super
  @initial_options = TypeRestrictedArray.new(CompositionObjects::Option)
end
populate(hash, object) click to toggle source
# File lib/slack/block_kit/element/multi_external_select_element.rb, line 11
def self.populate(hash, object)
  hash[:initial_options].each(&object.initial_options.method(:<<)) if hash.key?(:initial_options)
  object.max_selected_items = hash[:max_selected_items] if hash.key?(:max_selected_items)

  super(hash, object)
end

Public Instance Methods

max_selected_items=(num) click to toggle source
# File lib/slack/block_kit/element/multi_external_select_element.rb, line 23
def max_selected_items=(num)
  raise TypeError, 'max_selected_items must be an integer' unless num.respond_to?(:to_int)

  @max_selected_items = num.to_i
end
to_h() click to toggle source
# File lib/slack/block_kit/element/multi_external_select_element.rb, line 29
def to_h
  super.merge(
    initial_options: initial_options&.to_h,
    max_selected_items: max_selected_items || 1
  ).compact
end