we use Virtus gem in telegram-bot-ruby gem.
Some attributes have type Array[Array[FooClass]], for instance
module Telegram
module Bot
module Types
class InlineKeyboardMarkup < Base
attribute :inline_keyboard, Array[Array[InlineKeyboardButton]]
end
end
end
end
module Telegram
module Bot
module Types
class InlineKeyboardButton < Base
attribute :text, String
attribute :url, String
...
end
end
end
end
But attribute inspection shows nothing about InlineKeyboardButton, just Array of Array:
To be honest I don't know much about Virtus.
Is Array[Array[FooClass]] a valid type for Virtus?
Do we need to provide some additional instructions to Virtus in order to get inline_keyboard attribute correctly coerced?
UPDATE
Should we switch to dry-rb/struct and dry-rb/types (those gems look like new alternative for Virtus for me)?
I created simple gist. It works just fine, I can find out actual type of Markup#keyboard
Hi,
we use Virtus gem in telegram-bot-ruby gem. Some attributes have type
Array[Array[FooClass]]
, for instanceBut attribute inspection shows nothing about
InlineKeyboardButton
, just Array of Array:And it isn't actually coerced to
InlineKeyboardButton
(it is Array of Array of Hash):To be honest I don't know much about Virtus. Is
Array[Array[FooClass]]
a valid type for Virtus? Do we need to provide some additional instructions to Virtus in order to getinline_keyboard
attribute correctly coerced?UPDATE Should we switch to dry-rb/struct and dry-rb/types (those gems look like new alternative for Virtus for me)? I created simple gist. It works just fine, I can find out actual type of
Markup#keyboard
Thank you.