Class: Overlook::Csgo::SharecodeDecoder
- Inherits:
-
Object
- Object
- Overlook::Csgo::SharecodeDecoder
- Defined in:
- lib/overlook/csgo/sharecode_decoder.rb
Constant Summary collapse
Class.new(StandardError)
- DecodingError =
Class.new(StandardError)
- DICTIONARY =
"ABCDEFGHJKLMNOPQRSTUVWXYZabcdefhijkmnopqrstuvwxyz23456789".freeze
- DICTIONARY_LENGTH =
DICTIONARY.length.freeze
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Instance Method Summary collapse
- #decode ⇒ Object
-
#initialize(_code) ⇒ SharecodeDecoder
constructor
A new instance of SharecodeDecoder.
Constructor Details
#initialize(_code) ⇒ SharecodeDecoder
Returns a new instance of SharecodeDecoder.
14 15 16 |
# File 'lib/overlook/csgo/sharecode_decoder.rb', line 14 def initialize(_code) @code = _code.dup end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
12 13 14 |
# File 'lib/overlook/csgo/sharecode_decoder.rb', line 12 def code @code end |
Instance Method Details
#decode ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/overlook/csgo/sharecode_decoder.rb', line 18 def decode sanitize_code! reader = ByteReader.new(io) matchid = reader.read_int64 outcomeid = reader.read_int64 tokenid = reader.read_short { matchid: matchid.to_s, outcomeid: outcomeid.to_s, tokenid: tokenid.to_s } end |