atipugin / telegram-bot-ruby

Ruby wrapper for Telegram's Bot API
https://core.telegram.org/bots/api
Do What The F*ck You Want To Public License
1.36k stars 222 forks source link

Fix inheritance issue #200

Closed vladislav-yashin closed 5 years ago

vladislav-yashin commented 5 years ago

There was an issue with inheritance: when passing instances of Telegram::Bot::Types::InlineKeyboardMarkup (e.g.) descendants, it failed to jsonify objects.

atipugin commented 5 years ago

Hi, @funk-yourself! Just curious, what's a point of inheriting from Telegram::Bot::Types::InlineKeyboardMarkup?

vladislav-yashin commented 5 years ago

I needed to override the initializer: https://github.com/centosadmin/redmine_intouch/blob/a51cc5420c3cc93175acee64f44ceba1690aee3f/lib/intouch/preview/keyboard_markup.rb

Also, in general this change is intended to satisfy Liskov substitution principle: "if S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e. an object of type T may be substituted with any object of a subtype S) without altering any of the desirable properties of the program"

atipugin commented 5 years ago

Sounds reasonable! Merged!