class Slack::BlockKit::CompositionObjects::Filter

Attributes

exclude_bot_users[R]
exclude_external_shared_channels[R]
include[R]

Public Class Methods

[](hash) click to toggle source
# File lib/slack/block_kit/composition_objects/filter.rb, line 10
def self.[](hash)
  new.tap do |object|
    hash[:include].each(&object.include.method(:<<))
    object.exclude_external_shared_channels! if hash[:exclude_external_shared_channels]
    object.exclude_bot_users! if hash[:exclude_bot_users]
  end
end
new() click to toggle source
# File lib/slack/block_kit/composition_objects/filter.rb, line 18
def initialize
  @include = TypeRestrictedArray.new(String)
end

Public Instance Methods

exclude_bot_users!() click to toggle source
# File lib/slack/block_kit/composition_objects/filter.rb, line 26
def exclude_bot_users!
  @exclude_bot_users = true
end
exclude_external_shared_channels!() click to toggle source
# File lib/slack/block_kit/composition_objects/filter.rb, line 22
def exclude_external_shared_channels!
  @exclude_external_shared_channels = true
end
to_h() click to toggle source
# File lib/slack/block_kit/composition_objects/filter.rb, line 30
def to_h
  { include: self.include,
    exclude_external_shared_channels: exclude_external_shared_channels,
    exclude_bot_users: exclude_bot_users }.compact
end