Class: SlackWidgets::StaticPicker
- Defined in:
- lib/slack_widgets/widgets/pickers/static_picker.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, options:, text: nil, selected_index: nil, value: nil) ⇒ StaticPicker
constructor
A new instance of StaticPicker.
- #render ⇒ Object
Constructor Details
#initialize(name:, options:, text: nil, selected_index: nil, value: nil) ⇒ StaticPicker
Returns a new instance of StaticPicker.
3 4 5 6 7 8 |
# File 'lib/slack_widgets/widgets/pickers/static_picker.rb', line 3 def initialize(name:, options:, text: nil, selected_index: nil, value: nil) @options = @value = value @pre_selection = selected_index ? [selected_index] : nil super(name: name, text: text) end |
Class Method Details
.create(name:, options:, text: nil, selected_index: nil, value: nil) ⇒ Object
17 18 19 |
# File 'lib/slack_widgets/widgets/pickers/static_picker.rb', line 17 def self.create(name:, options:, text: nil, selected_index: nil, value: nil) new(name: name, options: , text: text, selected_index: selected_index, value: value).render end |
Instance Method Details
#render ⇒ Object
10 11 12 13 14 15 |
# File 'lib/slack_widgets/widgets/pickers/static_picker.rb', line 10 def render super.merge('data_source': 'static', 'options': @options, 'selected_options': [@pre_selection], 'value': @value) end |