class Slack::BlockKit::Element::OverflowElement
Attributes
confirm[R]
options[R]
Public Class Methods
new()
click to toggle source
# File lib/slack/block_kit/element/overflow_element.rb, line 17 def initialize @options = TypeRestrictedArray.new(CompositionObjects::Option) end
populate(hash, object)
click to toggle source
Calls superclass method
Slack::BlockKit::Element::populate
# File lib/slack/block_kit/element/overflow_element.rb, line 10 def self.populate(hash, object) hash[:options].each(&object.options.method(:<<)) if hash.key?(:options) object.confirm = hash.fetch(:confirm) if hash[:confirm] super(hash, object) end
Public Instance Methods
confirm=(obj)
click to toggle source
# File lib/slack/block_kit/element/overflow_element.rb, line 25 def confirm=(obj) unless obj.is_a?(CompositionObjects::ConfirmationDialog) raise TypeError, 'confirm must be a ConfirmationDialog Object' end @confirm = obj end
to_h()
click to toggle source
Calls superclass method
Slack::BlockKit::Element#to_h
# File lib/slack/block_kit/element/overflow_element.rb, line 33 def to_h super.merge( options: options.map(&:to_h), confirm: confirm&.to_h ).compact end
valid?()
click to toggle source
# File lib/slack/block_kit/element/overflow_element.rb, line 21 def valid? (2..5).include?(options.size) end