Class: TelegramOnSteroids::Keyboard::Button
- Inherits:
-
Object
- Object
- TelegramOnSteroids::Keyboard::Button
- Extended by:
- Configurable
- Defined in:
- lib/telegram_on_steroids/keyboard/button.rb
Instance Attribute Summary collapse
-
#callback_data ⇒ Object
readonly
Returns the value of attribute callback_data.
-
#keyboard ⇒ Object
readonly
Returns the value of attribute keyboard.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text:, callback_data:, keyboard:) ⇒ Button
constructor
A new instance of Button.
- #to_telegram_format ⇒ Object
Methods included from Configurable
Constructor Details
#initialize(text:, callback_data:, keyboard:) ⇒ Button
Returns a new instance of Button.
4 5 6 7 8 |
# File 'lib/telegram_on_steroids/keyboard/button.rb', line 4 def initialize(text:, callback_data:, keyboard:) @text = text @callback_data = callback_data @keyboard = keyboard end |
Instance Attribute Details
#callback_data ⇒ Object (readonly)
Returns the value of attribute callback_data.
15 16 17 |
# File 'lib/telegram_on_steroids/keyboard/button.rb', line 15 def callback_data @callback_data end |
#keyboard ⇒ Object (readonly)
Returns the value of attribute keyboard.
15 16 17 |
# File 'lib/telegram_on_steroids/keyboard/button.rb', line 15 def keyboard @keyboard end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
15 16 17 |
# File 'lib/telegram_on_steroids/keyboard/button.rb', line 15 def text @text end |
Instance Method Details
#to_telegram_format ⇒ Object
10 11 12 13 |
# File 'lib/telegram_on_steroids/keyboard/button.rb', line 10 def to_telegram_format text = @text.is_a?(Proc) ? keyboard.instance_eval(&@text) : @text { text:, callback_data: } end |