Module: Oboe::Util::Base64URL
- Defined in:
- lib/oboe/loading.rb
Overview
This module is used solely for RUM ID calculation
Class Method Summary collapse
Class Method Details
.decode(bin) ⇒ Object
21 22 23 24 25 |
# File 'lib/oboe/loading.rb', line 21 def decode(bin) m = bin.size % 4 bin += '=' * (4 - m) if m != 0 bin.tr('-_', '+/').unpack('m0').first end |
.encode(bin) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/oboe/loading.rb', line 14 def encode(bin) c = [bin].pack('m0').gsub(/\=+\Z/, '').tr('+/', '-_').rstrip m = c.size % 4 c += '=' * (4 - m) if m != 0 c end |