Class: TelegramOnSteroids::Keyboard
- Inherits:
-
Object
- Object
- TelegramOnSteroids::Keyboard
- Extended by:
- Configurable
- Defined in:
- lib/telegram_on_steroids/keyboard.rb
Direct Known Subclasses
Defined Under Namespace
Modules: Paginatable Classes: Button, Inline, Row
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#buttons ⇒ Object
readonly
Returns the value of attribute buttons.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #after_initialize ⇒ Object
- #button(**button) ⇒ Object
-
#initialize(request:, action:) ⇒ Keyboard
constructor
A new instance of Keyboard.
- #row {|row| ... } ⇒ Object
- #to_telegram_format ⇒ Object
Methods included from Configurable
Constructor Details
#initialize(request:, action:) ⇒ Keyboard
Returns a new instance of Keyboard.
7 8 9 10 11 12 |
# File 'lib/telegram_on_steroids/keyboard.rb', line 7 def initialize(request:, action:) @request = request @buttons = [] @action = action after_initialize end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
30 31 32 |
# File 'lib/telegram_on_steroids/keyboard.rb', line 30 def action @action end |
#buttons ⇒ Object (readonly)
Returns the value of attribute buttons.
30 31 32 |
# File 'lib/telegram_on_steroids/keyboard.rb', line 30 def @buttons end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
30 31 32 |
# File 'lib/telegram_on_steroids/keyboard.rb', line 30 def request @request end |
Instance Method Details
#after_initialize ⇒ Object
14 |
# File 'lib/telegram_on_steroids/keyboard.rb', line 14 def after_initialize; end |
#button(**button) ⇒ Object
16 17 18 |
# File 'lib/telegram_on_steroids/keyboard.rb', line 16 def (**) @buttons.push([Button.new(**, keyboard: self).to_telegram_format]) end |
#row {|row| ... } ⇒ Object
20 21 22 23 24 |
# File 'lib/telegram_on_steroids/keyboard.rb', line 20 def row row = Row.new(keyboard: self) yield row .push(row.) end |
#to_telegram_format ⇒ Object
26 27 28 |
# File 'lib/telegram_on_steroids/keyboard.rb', line 26 def to_telegram_format end |