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