Sha256: 5965636302f39d06d59766b54c253537302d9ba5f1de0d426887f9640c4ea404

Contents?: true

Size: 803 Bytes

Versions: 2

Compression:

Stored size: 803 Bytes

Contents

# frozen_string_literal: true

module Telegram
  module Bot
    module Types
      class ReplyKeyboardMarkup < Base
        attribute :keyboard, Types::Array.of(Types::Array.of(KeyboardButton))
        attribute? :is_persistent, Types::Bool.default(false)
        attribute? :resize_keyboard, Types::Bool.default(false)
        attribute? :one_time_keyboard, Types::Bool.default(false)
        attribute? :input_field_placeholder, Types::String.constrained(min_size: 1, max_size: 64)
        attribute? :selective, Types::Bool

        def to_compact_hash
          hsh = super
          hsh[:keyboard].map! do |arr|
            arr.map do |item|
              item.is_a?(KeyboardButton) ? item.to_compact_hash : item
            end
          end

          hsh
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
telegram-bot-ruby-2.2.0 lib/telegram/bot/types/reply_keyboard_markup.rb
telegram-bot-ruby-2.1.0 lib/telegram/bot/types/reply_keyboard_markup.rb