Method: CF::UAA::Util.encode64

Defined in:
lib/uaa/util.rb

.encode64(obj) ⇒ String

Encodes obj as a URL-safe base 64 encoded string, with trailing padding removed.

Returns:

  • (String)


162
163
164
165
166
167
# File 'lib/uaa/util.rb', line 162

def self.encode64(obj)
  str = Base64.respond_to?(:urlsafe_encode64)? Base64.urlsafe_encode64(obj):
      [obj].pack("m").tr("+/", "-_")
  str.gsub!(/(\n|=*$)/, '')
  str
end