Sha256: 9c609976760cf58c74fc512e4e73ab807b8860572f46800cfd9b2fd70aa23228

Contents?: true

Size: 421 Bytes

Versions: 2

Compression:

Stored size: 421 Bytes

Contents

require 'base64'

module CiderCi
  module OpenSession
    module Encoder
      extend self
      def encode(msg)
        ::Base64.urlsafe_encode64(msg).gsub(/[=]+$/, '')
      end

      def decode(msg)
        ::Base64.urlsafe_decode64(
          case msg.length % 4
          when 2
            msg + '=='
          when 3
            msg + '='
          else
            msg
          end)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
cider_ci-open_session-1.0.0 lib/cider_ci/open_session/encoder.rb
cider_ci-open_session-rails-1.0.0 lib/cider_ci/open_session/encoder.rb