class Xasin::Telegram::KeyboardLayout
Public Class Methods
new(start_config = nil)
click to toggle source
# File lib/xasin/telegram/KeyboardLayout.rb, line 5 def initialize(start_config = nil) @rows = Array.new() if start_config.is_a? Hash start_config = [start_config] end if start_config.is_a? Array start_config.each_index do |i| j = 0 start_config[i].each do |k, v| set_button(k, v, r: i, c: j) j += 1 end end end end
Public Instance Methods
[](i)
click to toggle source
# File lib/xasin/telegram/KeyboardLayout.rb, line 23 def [](i) @rows[i] end
ilk_reply_markup()
click to toggle source
# File lib/xasin/telegram/KeyboardLayout.rb, line 41 def ilk_reply_markup() return { inline_keyboard: to_ilk_layout } end
to_ilk_layout()
click to toggle source
# File lib/xasin/telegram/KeyboardLayout.rb, line 45 def to_ilk_layout() out_data = []; @rows.each do |row| next if row.nil? next if row.empty? formatted_row = [] row.each do |button| next if button.nil? formatted_row << button end out_data << formatted_row unless formatted_row.empty? end out_data end