Sha256: 89f762f248ecebbd6c670435c9bdef8e150ecaef202dd5aaee1b9debc03ebca0

Contents?: true

Size: 404 Bytes

Versions: 3

Compression:

Stored size: 404 Bytes

Contents

class TelegramOnSteroids::Keyboard::Button
  extend TelegramOnSteroids::Configurable

  def initialize(text:, callback_data:, keyboard:)
    @text = text
    @callback_data = callback_data
    @keyboard = keyboard
  end

  def to_telegram_format
    text = @text.is_a?(Proc) ? keyboard.instance_eval(&@text) : @text
    { text:, callback_data: }
  end

  attr_reader :text, :callback_data, :keyboard
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
telegram_on_steroids-0.1.2 lib/telegram_on_steroids/keyboard/button.rb
telegram_on_steroids-0.1.1 lib/telegram_on_steroids/keyboard/button.rb
telegram_on_steroids-0.1.0 lib/telegram_on_steroids/keyboard/button.rb