Module: CBOR_DIAG::B64string2

Defined in:
lib/cbor-diag-parser.rb

Instance Method Summary collapse

Instance Method Details

#to_rbObject



2495
2496
2497
2498
2499
2500
2501
# File 'lib/cbor-diag-parser.rb', line 2495

def to_rb;
  t = s.text_value.gsub(/\s/, '').chars.each_slice(4).map(&:join)
  if last = t[-1]
    last << "=" * (4 - last.size)
  end
  t.join.tr("-_", "+/").unpack("m0")[0]
end