Class: Slackened::BlockKit::Blocks::Actions
- Defined in:
- lib/slackened/block_kit/blocks/actions.rb
Constant Summary collapse
- MAX_LENGTH =
25- ELEMENTS =
%i(button checkboxes datepicker datetimepicker email_text_input file_input image multi_static_select multi_external_select multi_users_select multi_conversations_select multi_channels_select number_input overflow plain_text_input radio_buttons rich_text_input option_groups external_select users_select conversations_select channels_select timepicker url_text_input workflow_button)
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(*elements) ⇒ Actions
constructor
A new instance of Actions.
Methods inherited from Base
Constructor Details
#initialize(*elements) ⇒ Actions
Returns a new instance of Actions.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/slackened/block_kit/blocks/actions.rb', line 13 def initialize(*elements) raise MinimumElementsError if elements.length.zero? raise MaximumElementsError, "#{elements.count} can't be greater than #{MAX_LENGTH}" if elements.length > MAX_LENGTH set({ type: :actions, elements: elements.map do |element| raise InvalidElement unless ELEMENTS.include? element.block[:type] element end }) self end |