Sha256: 2e1977aa90dd2d9321e4517ed03cff1626e04c939cf7805c70f58c770193a287

Contents?: true

Size: 802 Bytes

Versions: 1

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

module Slack
  module BlockKit
    class Element
      class ChannelsSelectElement < SelectElement
        using Refinements::HashCompact
        attr_reader :initial_channel, :response_url_enabled
        attr_writer :initial_channel

        def self.populate(hash, object)
          object.initial_channel = hash[:initial_channel] if hash.key?(:initial_channel)
          object.response_url_enabled! if hash.key?(:response_url_enabled)

          super(hash, object)
        end

        def response_url_enabled!
          @response_url_enabled = true
        end

        def to_h
          super.merge(
            initial_channel: initial_channel,
            response_url_enabled: response_url_enabled
          ).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/channels_select_element.rb