Class: Slack::BlockKit::Layout::Input
- Inherits:
-
Object
- Object
- Slack::BlockKit::Layout::Input
- Defined in:
- lib/slack/block_kit/layout/input.rb
Overview
A block that collects information from users - it can hold a plain-text input element, a select menu element, a multi-select menu element, or a datepicker.
Constant Summary collapse
- TYPE =
'input'
Instance Attribute Summary collapse
-
#block_id ⇒ Object
Returns the value of attribute block_id.
-
#element ⇒ Object
Returns the value of attribute element.
-
#emoji ⇒ Object
Returns the value of attribute emoji.
-
#hint ⇒ Object
Returns the value of attribute hint.
-
#label ⇒ Object
Returns the value of attribute label.
-
#optional ⇒ Object
Returns the value of attribute optional.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(label:, element:, block_id: nil, hint: nil, optional: nil, emoji: nil) ⇒ Input
constructor
A new instance of Input.
Constructor Details
#initialize(label:, element:, block_id: nil, hint: nil, optional: nil, emoji: nil) ⇒ Input
Returns a new instance of Input.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/slack/block_kit/layout/input.rb', line 16 def initialize( label:, element:, block_id: nil, hint: nil, optional: nil, emoji: nil ) @label = Composition::PlainText.new(text: label, emoji: emoji) if label @hint = Composition::PlainText.new(text: hint, emoji: emoji) if hint @block_id = block_id @optional = optional @element = element end |
Instance Attribute Details
#block_id ⇒ Object
Returns the value of attribute block_id.
14 15 16 |
# File 'lib/slack/block_kit/layout/input.rb', line 14 def block_id @block_id end |
#element ⇒ Object
Returns the value of attribute element.
14 15 16 |
# File 'lib/slack/block_kit/layout/input.rb', line 14 def element @element end |
#emoji ⇒ Object
Returns the value of attribute emoji.
14 15 16 |
# File 'lib/slack/block_kit/layout/input.rb', line 14 def emoji @emoji end |
#hint ⇒ Object
Returns the value of attribute hint.
14 15 16 |
# File 'lib/slack/block_kit/layout/input.rb', line 14 def hint @hint end |
#label ⇒ Object
Returns the value of attribute label.
14 15 16 |
# File 'lib/slack/block_kit/layout/input.rb', line 14 def label @label end |
#optional ⇒ Object
Returns the value of attribute optional.
14 15 16 |
# File 'lib/slack/block_kit/layout/input.rb', line 14 def optional @optional end |
Instance Method Details
#as_json ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/slack/block_kit/layout/input.rb', line 31 def as_json(*) { type: TYPE, element: @element.as_json, label: @label&.as_json, hint: @hint&.as_json, block_id: @block_id, optional: optional }.compact end |