Class: Slack::BlockKit::Element::ButtonElement
- Inherits:
-
Slack::BlockKit::Element
- Object
- Slack::BlockKit::Element
- Slack::BlockKit::Element::ButtonElement
- Defined in:
- lib/slack/block_kit/element/button_element.rb
Instance Attribute Summary collapse
-
#style ⇒ Object
Returns the value of attribute style.
-
#text ⇒ Object
Returns the value of attribute text.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from Slack::BlockKit::Element
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Slack::BlockKit::Element
Instance Attribute Details
#style ⇒ Object
Returns the value of attribute style.
8 9 10 |
# File 'lib/slack/block_kit/element/button_element.rb', line 8 def style @style end |
#text ⇒ Object
Returns the value of attribute text.
8 9 10 |
# File 'lib/slack/block_kit/element/button_element.rb', line 8 def text @text end |
#value ⇒ Object
Returns the value of attribute value.
9 10 11 |
# File 'lib/slack/block_kit/element/button_element.rb', line 9 def value @value end |
Class Method Details
.populate(hash, object) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/slack/block_kit/element/button_element.rb', line 11 def self.populate(hash, object) object.text = hash.fetch(:text) object.action_id = hash.fetch(:action_id) if hash[:action_id] object.style = hash.fetch(:style) if hash[:style] object.value = hash.fetch(:value) if hash[:value] super(hash, object) end |
Instance Method Details
#to_h ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/slack/block_kit/element/button_element.rb', line 38 def to_h super.merge( text: text.to_h, style: style, value: value ).compact end |
#valid? ⇒ Boolean
20 21 22 |
# File 'lib/slack/block_kit/element/button_element.rb', line 20 def valid? !@text.empty? end |