Class: Slack::BlockKit::Element::MultiUsersSelectElement
- Inherits:
-
UsersSelectElement
- Object
- Slack::BlockKit::Element
- SelectElement
- UsersSelectElement
- Slack::BlockKit::Element::MultiUsersSelectElement
- Defined in:
- lib/slack/block_kit/element/multi_users_select_element.rb
Instance Attribute Summary collapse
-
#initial_users ⇒ Object
readonly
Returns the value of attribute initial_users.
-
#max_selected_items ⇒ Object
Returns the value of attribute max_selected_items.
Attributes inherited from UsersSelectElement
Attributes inherited from SelectElement
Attributes inherited from Slack::BlockKit::Element
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ MultiUsersSelectElement
constructor
A new instance of MultiUsersSelectElement.
- #to_h ⇒ Object
Methods inherited from SelectElement
Methods inherited from Slack::BlockKit::Element
Constructor Details
#initialize ⇒ MultiUsersSelectElement
Returns a new instance of MultiUsersSelectElement.
19 20 21 22 |
# File 'lib/slack/block_kit/element/multi_users_select_element.rb', line 19 def initialize super @initial_users = [] end |
Instance Attribute Details
#initial_users ⇒ Object (readonly)
Returns the value of attribute initial_users.
10 11 12 |
# File 'lib/slack/block_kit/element/multi_users_select_element.rb', line 10 def initial_users @initial_users end |
#max_selected_items ⇒ Object
Returns the value of attribute max_selected_items.
10 11 12 |
# File 'lib/slack/block_kit/element/multi_users_select_element.rb', line 10 def max_selected_items @max_selected_items end |
Class Method Details
.populate(hash, object) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/slack/block_kit/element/multi_users_select_element.rb', line 12 def self.populate(hash, object) hash[:initial_users].each(&object.initial_users.method(:<<)) if hash.key?(:initial_users) object.max_selected_items = hash[:max_selected_items] if hash.key?(:max_selected_items) super(hash, object) end |
Instance Method Details
#to_h ⇒ Object
30 31 32 33 34 35 |
# File 'lib/slack/block_kit/element/multi_users_select_element.rb', line 30 def to_h super.merge( initial_users: initial_users&.to_h, max_selected_items: max_selected_items || 1 ).compact end |