class ADSB::Message
Attributes
created_at[R]
Public Class Methods
new(body, created_at = Time.now)
click to toggle source
Create a new message.
Attributes¶ ↑
-
body
- The body of the message as a hexadecimal string -
created_at
- The time at which the message was created
Examples¶ ↑
message = ADSB::Message.new('8D4840D6202CC371C32CE0576098') message = ADSB::Message.new('8D4840D6202CC371C32CE0576098', Time.now)
# File lib/adsb/message.rb, line 14 def initialize body, created_at = Time.now @body = body.hex.to_s(2) @created_at = created_at decoder = Kernel.const_get("ADSB::Messages::#{type.to_s.capitalize}") extend(decoder) end
Public Instance Methods
address()
click to toggle source
data()
click to toggle source
# File lib/adsb/message.rb, line 30 def data @body[32..87] end
downlink_format()
click to toggle source
# File lib/adsb/message.rb, line 34 def downlink_format @body[0..4].to_i(2) end
type()
click to toggle source
type_code()
click to toggle source
# File lib/adsb/message.rb, line 51 def type_code @body[32..36].to_i(2) end