Class: Telegram::Bot::Types::Base
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Telegram::Bot::Types::Base
- Defined in:
- lib/telegram/bot/types/base.rb
Direct Known Subclasses
Animation, Audio, CallbackGame, CallbackQuery, Chat, ChatInviteLink, ChatLocation, ChatMember, ChatMemberUpdated, ChatPermissions, ChatPhoto, ChosenInlineResult, Contact, Dice, Document, EncryptedCredentials, EncryptedPassportElement, File, ForceReply, Game, GameHighScore, InlineKeyboardButton, InlineKeyboardMarkup, InlineQuery, InlineQueryResultArticle, InlineQueryResultAudio, InlineQueryResultCachedAudio, InlineQueryResultCachedDocument, InlineQueryResultCachedGif, InlineQueryResultCachedMpeg4Gif, InlineQueryResultCachedPhoto, InlineQueryResultCachedSticker, InlineQueryResultCachedVideo, InlineQueryResultCachedVoice, InlineQueryResultContact, InlineQueryResultDocument, InlineQueryResultGame, InlineQueryResultGif, InlineQueryResultLocation, InlineQueryResultMpeg4Gif, InlineQueryResultPhoto, InlineQueryResultVenue, InlineQueryResultVideo, InlineQueryResultVoice, InputMediaAnimation, InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo, InputMessageContent, Invoice, KeyboardButton, KeyboardButtonPollType, LabeledPrice, Location, LoginUrl, MaskPosition, Message, MessageAutoDeleteTimerChanged, MessageEntity, OrderInfo, PassportData, PassportElementErrorDataField, PassportElementErrorFile, PassportElementErrorFiles, PassportElementErrorFrontSide, PassportElementErrorReverseSide, PassportElementErrorSelfie, PassportElementErrorTranslationFile, PassportElementErrorTranslationFiles, PassportElementErrorUnspecified, PassportFile, PhotoSize, Poll, PollAnswer, PollOption, PreCheckoutQuery, ProximityAlertTriggered, ReplyKeyboardMarkup, ReplyKeyboardRemove, ShippingAddress, ShippingOption, ShippingQuery, Sticker, StickerSet, SuccessfulPayment, Update, User, UserProfilePhotos, Venue, Video, VideoNote, Voice, VoiceChatEnded, VoiceChatParticipantsInvited, VoiceChatStarted, WebhookInfo
Class Method Summary collapse
-
.attribute(name, *args, &block) ⇒ Object
Make all attributes optional.
Instance Method Summary collapse
-
#[](name) ⇒ Object
Access fields by string values for backward compatibility.
Class Method Details
.attribute(name, *args, &block) ⇒ Object
Make all attributes optional. Copied from #attribute?
24 25 26 |
# File 'lib/telegram/bot/types/base.rb', line 24 def attribute(name, *args, &block) super(:"#{name}?", build_type(name, *args, &block)) end |
Instance Method Details
#[](name) ⇒ Object
Access fields by string values for backward compatibility. Don’t raise errors when accessing missing attributes. github.com/dry-rb/dry-struct/pull/177
32 33 34 35 36 37 |
# File 'lib/telegram/bot/types/base.rb', line 32 def [](name) name = name.to_sym super(name) rescue MissingAttributeError raise unless self.class.attribute_names.include?(name) end |