Class: Slack::BlockKit::Element::Timepicker
- Inherits:
-
Object
- Object
- Slack::BlockKit::Element::Timepicker
- Defined in:
- lib/slack/block_kit/element/timepicker.rb
Overview
An element which allows selection of a time of day.
On desktop clients, this time picker will take the form of a dropdown list with free-text entry for precise choices. On mobile clients, the time picker will use native time picker UIs.
Constant Summary collapse
- TYPE =
'timepicker'
Instance Method Summary collapse
- #as_json ⇒ Object
- #initial_time(time_str) ⇒ Object
-
#initialize(action_id:) {|_self| ... } ⇒ Timepicker
constructor
A new instance of Timepicker.
- #placeholder(text:, emoji: nil) ⇒ Object
Methods included from Composition::ConfirmationDialog::Confirmable
#confirmation_dialog, included
Constructor Details
#initialize(action_id:) {|_self| ... } ⇒ Timepicker
Returns a new instance of Timepicker.
18 19 20 21 22 23 |
# File 'lib/slack/block_kit/element/timepicker.rb', line 18 def initialize(action_id:) @placeholder, @initial_time = nil @action_id = action_id yield(self) if block_given? end |
Instance Method Details
#as_json ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/slack/block_kit/element/timepicker.rb', line 37 def as_json(*) { type: TYPE, action_id: @action_id, placeholder: @placeholder&.as_json, initial_time: @initial_time, confirm: confirm&.as_json }.compact end |
#initial_time(time_str) ⇒ Object
31 32 33 34 35 |
# File 'lib/slack/block_kit/element/timepicker.rb', line 31 def initial_time(time_str) @initial_time = time_str self end |
#placeholder(text:, emoji: nil) ⇒ Object
25 26 27 28 29 |
# File 'lib/slack/block_kit/element/timepicker.rb', line 25 def placeholder(text:, emoji: nil) @placeholder = Composition::PlainText.new(text: text, emoji: emoji) self end |