mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
18 lines
320 B
Ruby
18 lines
320 B
Ruby
class IMICFPS
|
|
module Networking
|
|
class Packet
|
|
def initialize(type:, payload:)
|
|
end
|
|
|
|
def self.encode(packet)
|
|
"#{packet.type}|#{packet.payload}"
|
|
end
|
|
|
|
def self.decode(string)
|
|
split = string.split("|")
|
|
|
|
Packet.new(split.first, split.last)
|
|
end
|
|
end
|
|
end
|
|
end |