Class: Warb::Components::ReplyButtonAction
- Inherits:
-
Object
- Object
- Warb::Components::ReplyButtonAction
- Defined in:
- lib/warb/components/action.rb
Instance Attribute Summary collapse
-
#buttons_texts ⇒ Object
Returns the value of attribute buttons_texts.
Instance Method Summary collapse
-
#add_button_text(button_text) ⇒ Object
rubocop:enable Metrics/MethodLength.
-
#initialize(buttons_texts: []) ⇒ ReplyButtonAction
constructor
A new instance of ReplyButtonAction.
-
#to_h ⇒ Object
rubocop:disable Metrics/MethodLength.
Constructor Details
#initialize(buttons_texts: []) ⇒ ReplyButtonAction
Returns a new instance of ReplyButtonAction.
78 79 80 |
# File 'lib/warb/components/action.rb', line 78 def initialize(buttons_texts: []) = end |
Instance Attribute Details
#buttons_texts ⇒ Object
Returns the value of attribute buttons_texts.
76 77 78 |
# File 'lib/warb/components/action.rb', line 76 def end |
Instance Method Details
#add_button_text(button_text) ⇒ Object
rubocop:enable Metrics/MethodLength
101 102 103 |
# File 'lib/warb/components/action.rb', line 101 def () << end |
#to_h ⇒ Object
rubocop:disable Metrics/MethodLength
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/warb/components/action.rb', line 83 def to_h { buttons: .map.with_index do |, index| text = .normalize.gsub(/\s/, '').downcase id = "#{text}_#{index}" { type: 'reply', reply: { id: id, title: } } end } end |