Sha256: 598de1db951e46818e140c58ad3207d0ee806d24ea0fa07daddf0fb05c30ebba

Contents?: true

Size: 579 Bytes

Versions: 3

Compression:

Stored size: 579 Bytes

Contents

module TelegramOnSteroids
  class Keyboard
    extend Configurable

    callable :text

    def initialize(request:, action:)
      @request = request
      @buttons = []
      @action = action
      after_initialize
    end

    def after_initialize; end

    def button(**button)
      @buttons.push([Button.new(**button, keyboard: self).to_telegram_format])
    end

    def row
      row = Row.new(keyboard: self)
      yield row
      buttons.push(row.buttons)
    end

    def to_telegram_format
      buttons
    end

    attr_reader :buttons, :request, :action
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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