module CBOR_DIAG::B64string2
Public Instance Methods
to_rb()
click to toggle source
“
# File lib/cbor-diag-parser.rb, line 2452 def to_rb; t = s.text_value.gsub(/\s/, '').chars.each_slice(4).map(&:join) if last = t[-1] last << "=" * (4 - last.size) end begin t.join.tr("-_", "+/").unpack("m0")[0] rescue ArgumentError raise ArgumentError.new("invalid base64 #{t}") end end