Class: Slack::BlockKit::CompositionObjects::Option
- Inherits:
-
Object
- Object
- Slack::BlockKit::CompositionObjects::Option
- Defined in:
- lib/slack/block_kit/composition_objects/option.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#text ⇒ Object
Returns the value of attribute text.
-
#url ⇒ Object
Returns the value of attribute url.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
8 9 10 |
# File 'lib/slack/block_kit/composition_objects/option.rb', line 8 def description @description end |
#text ⇒ Object
Returns the value of attribute text.
8 9 10 |
# File 'lib/slack/block_kit/composition_objects/option.rb', line 8 def text @text end |
#url ⇒ Object
Returns the value of attribute url.
8 9 10 |
# File 'lib/slack/block_kit/composition_objects/option.rb', line 8 def url @url end |
#value ⇒ Object
Returns the value of attribute value.
8 9 10 |
# File 'lib/slack/block_kit/composition_objects/option.rb', line 8 def value @value end |
Class Method Details
.[](hash) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/slack/block_kit/composition_objects/option.rb', line 10 def self.[](hash) new.tap do |object| object.text = hash.fetch(:text) object.value = hash.fetch(:value) object.description = hash[:description] if hash.key?(:description) object.url = hash[:url] if hash.key?(:url) end end |
Instance Method Details
#to_h ⇒ Object
48 49 50 51 52 53 |
# File 'lib/slack/block_kit/composition_objects/option.rb', line 48 def to_h { text: text.to_h, value: value, description: description&.to_h, url: url }.compact end |