Sha256: 260cdb76064ee41e3bbe9ff55a6ef7910ac9f6bfbb356e76fdf90f2c4460ddae
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module Slack module BlockKit class Element class MultiConversationsSelectElement < ConversationsSelectElement using Refinements::HashCompact undef_method :initial_conversation= attr_reader :initial_conversations, :max_selected_items def self.populate(hash, object) hash[:initial_conversations].each(&object.initial_conversations.method(:<<)) if hash.key?(:initial_conversations) object.max_selected_items = hash[:max_selected_items] if hash.key?(:max_selected_items) super(hash, object) end def initialize super @initial_conversations = [] end 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 def to_h super.merge( initial_conversations: initial_conversations&.to_h, max_selected_items: max_selected_items || 1 ).compact end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slack-block-kit-0.1.0 | lib/slack/block_kit/element/multi_conversations_select_element.rb |