Class: MTProto::Type::Config
- Inherits:
-
Object
- Object
- MTProto::Type::Config
- Defined in:
- lib/mtproto/type/config.rb
Constant Summary collapse
- CONSTRUCTOR =
0xcc1a241e- CONSTRUCTOR_ALT =
0x3072cfa1
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#dc_options ⇒ Object
readonly
Returns the value of attribute dc_options.
-
#expires ⇒ Object
readonly
Returns the value of attribute expires.
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#test_mode ⇒ Object
readonly
Returns the value of attribute test_mode.
-
#this_dc ⇒ Object
readonly
Returns the value of attribute this_dc.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(flags:, date:, expires:, test_mode:, this_dc:, dc_options:) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(flags:, date:, expires:, test_mode:, this_dc:, dc_options:) ⇒ Config
Returns a new instance of Config.
54 55 56 57 58 59 60 61 |
# File 'lib/mtproto/type/config.rb', line 54 def initialize(flags:, date:, expires:, test_mode:, this_dc:, dc_options:) @flags = flags @date = date @expires = expires @test_mode = test_mode @this_dc = this_dc @dc_options = end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
9 10 11 |
# File 'lib/mtproto/type/config.rb', line 9 def date @date end |
#dc_options ⇒ Object (readonly)
Returns the value of attribute dc_options.
9 10 11 |
# File 'lib/mtproto/type/config.rb', line 9 def @dc_options end |
#expires ⇒ Object (readonly)
Returns the value of attribute expires.
9 10 11 |
# File 'lib/mtproto/type/config.rb', line 9 def expires @expires end |
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
9 10 11 |
# File 'lib/mtproto/type/config.rb', line 9 def flags @flags end |
#test_mode ⇒ Object (readonly)
Returns the value of attribute test_mode.
9 10 11 |
# File 'lib/mtproto/type/config.rb', line 9 def test_mode @test_mode end |
#this_dc ⇒ Object (readonly)
Returns the value of attribute this_dc.
9 10 11 |
# File 'lib/mtproto/type/config.rb', line 9 def this_dc @this_dc end |
Class Method Details
.deserialize(data) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/mtproto/type/config.rb', line 11 def self.deserialize(data) offset = 4 flags = data[offset, 4].unpack1('L<') offset += 4 date = data[offset, 4].unpack1('L<') offset += 4 expires = data[offset, 4].unpack1('L<') offset += 4 test_mode = (data[offset, 4].unpack1('L<') == 0x997275b5) offset += 4 this_dc = data[offset, 4].unpack1('L<') offset += 4 = data[offset, 4].unpack1('L<') offset += 4 raise "Expected vector constructor 0x1cb5c415, got 0x#{.to_s(16)}" unless == 0x1cb5c415 = data[offset, 4].unpack1('L<') offset += 4 = [] .times do dc_option, bytes_read = DcOption.deserialize_from(data[offset..]) << dc_option offset += bytes_read end new( flags: flags, date: date, expires: expires, test_mode: test_mode, this_dc: this_dc, dc_options: ) end |