Class: Slack::BlockKit::Element::OverflowElement
- Inherits:
-
Slack::BlockKit::Element
- Object
- Slack::BlockKit::Element
- Slack::BlockKit::Element::OverflowElement
- Defined in:
- lib/slack/block_kit/element/overflow_element.rb
Instance Attribute Summary collapse
-
#confirm ⇒ Object
Returns the value of attribute confirm.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Attributes inherited from Slack::BlockKit::Element
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ OverflowElement
constructor
A new instance of OverflowElement.
- #to_h ⇒ Object
- #valid? ⇒ Boolean
Methods inherited from Slack::BlockKit::Element
Constructor Details
#initialize ⇒ OverflowElement
Returns a new instance of OverflowElement.
17 18 19 |
# File 'lib/slack/block_kit/element/overflow_element.rb', line 17 def initialize @options = TypeRestrictedArray.new(CompositionObjects::Option) end |
Instance Attribute Details
#confirm ⇒ Object
Returns the value of attribute confirm.
8 9 10 |
# File 'lib/slack/block_kit/element/overflow_element.rb', line 8 def confirm @confirm end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/slack/block_kit/element/overflow_element.rb', line 8 def @options end |
Class Method Details
.populate(hash, object) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/slack/block_kit/element/overflow_element.rb', line 10 def self.populate(hash, object) hash[:options].each(&object..method(:<<)) if hash.key?(:options) object.confirm = hash.fetch(:confirm) if hash[:confirm] super(hash, object) end |
Instance Method Details
#to_h ⇒ Object
33 34 35 36 37 38 |
# File 'lib/slack/block_kit/element/overflow_element.rb', line 33 def to_h super.merge( options: .map(&:to_h), confirm: confirm&.to_h ).compact end |
#valid? ⇒ Boolean
21 22 23 |
# File 'lib/slack/block_kit/element/overflow_element.rb', line 21 def valid? (2..5).include?(.size) end |