Class: Telegem::Types::MessageEntity
- Defined in:
- lib/api/types.rb
Constant Summary collapse
- COMMON_FIELDS =
%w[type offset length url user language custom_emoji_id].freeze
Instance Attribute Summary
Attributes inherited from BaseType
Instance Method Summary collapse
-
#initialize(data) ⇒ MessageEntity
constructor
A new instance of MessageEntity.
Methods inherited from BaseType
#inspect, #method_missing, #respond_to_missing?, #to_h, #to_s
Constructor Details
#initialize(data) ⇒ MessageEntity
Returns a new instance of MessageEntity.
165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/api/types.rb', line 165 def initialize(data) super(data) COMMON_FIELDS.each do |field| define_accessor(field.to_sym) end if @_raw_data['user'] && !@_raw_data['user'].is_a?(User) @_raw_data['user'] = User.new(@_raw_data['user']) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Telegem::Types::BaseType