Class: Slack::BlockKit::Element::SelectElement

Inherits:
Slack::BlockKit::Element show all
Defined in:
lib/slack/block_kit/element/select_element.rb

Instance Attribute Summary collapse

Attributes inherited from Slack::BlockKit::Element

#action_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Slack::BlockKit::Element

[], #type

Instance Attribute Details

#confirmObject

Returns the value of attribute confirm.



7
8
9
# File 'lib/slack/block_kit/element/select_element.rb', line 7

def confirm
  @confirm
end

#placeholderObject

Returns the value of attribute placeholder.



7
8
9
# File 'lib/slack/block_kit/element/select_element.rb', line 7

def placeholder
  @placeholder
end

Class Method Details

.populate(hash, object) ⇒ Object



9
10
11
12
13
14
# File 'lib/slack/block_kit/element/select_element.rb', line 9

def self.populate(hash, object)
  object.placeholder = hash.fetch(:placeholder)
  object.confirm = hash[:confirm] if hash.key?(:confirm)

  super(hash, object)
end

Instance Method Details

#to_hObject



36
37
38
39
40
41
# File 'lib/slack/block_kit/element/select_element.rb', line 36

def to_h
  super.merge(
    placeholder: placeholder.to_h,
    confirm: confirm&.to_h
  )
end

#valid?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/slack/block_kit/element/select_element.rb', line 16

def valid?
  !(@placeholder.nil? || @placeholder.empty?)
end