Class: Slack::BlockKit::CompositionObjects::Filter
- Inherits:
-
Object
- Object
- Slack::BlockKit::CompositionObjects::Filter
- Defined in:
- lib/slack/block_kit/composition_objects/filter.rb
Instance Attribute Summary collapse
-
#exclude_bot_users ⇒ Object
readonly
Returns the value of attribute exclude_bot_users.
-
#exclude_external_shared_channels ⇒ Object
readonly
Returns the value of attribute exclude_external_shared_channels.
-
#include ⇒ Object
readonly
Returns the value of attribute include.
Class Method Summary collapse
Instance Method Summary collapse
- #exclude_bot_users! ⇒ Object
- #exclude_external_shared_channels! ⇒ Object
-
#initialize ⇒ Filter
constructor
A new instance of Filter.
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Filter
Returns a new instance of Filter.
18 19 20 |
# File 'lib/slack/block_kit/composition_objects/filter.rb', line 18 def initialize @include = TypeRestrictedArray.new(String) end |
Instance Attribute Details
#exclude_bot_users ⇒ Object (readonly)
Returns the value of attribute exclude_bot_users.
8 9 10 |
# File 'lib/slack/block_kit/composition_objects/filter.rb', line 8 def exclude_bot_users @exclude_bot_users end |
#exclude_external_shared_channels ⇒ Object (readonly)
Returns the value of attribute exclude_external_shared_channels.
8 9 10 |
# File 'lib/slack/block_kit/composition_objects/filter.rb', line 8 def exclude_external_shared_channels @exclude_external_shared_channels end |
#include ⇒ Object (readonly)
Returns the value of attribute include.
8 9 10 |
# File 'lib/slack/block_kit/composition_objects/filter.rb', line 8 def include @include end |
Class Method Details
.[](hash) ⇒ Object
10 11 12 13 14 15 16 |
# 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 |
Instance Method Details
#exclude_bot_users! ⇒ Object
26 27 28 |
# File 'lib/slack/block_kit/composition_objects/filter.rb', line 26 def exclude_bot_users! @exclude_bot_users = true end |
#exclude_external_shared_channels! ⇒ Object
22 23 24 |
# File 'lib/slack/block_kit/composition_objects/filter.rb', line 22 def exclude_external_shared_channels! @exclude_external_shared_channels = true end |
#to_h ⇒ Object
30 31 32 33 34 |
# 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 |