Sha256: 7e52c17d7668867f039ed1e8e98e9e4541d2ff17bf80666c619decbbe6d0908e

Contents?: true

Size: 485 Bytes

Versions: 1

Compression:

Stored size: 485 Bytes

Contents

require 'jwe/enc/a128cbc_hs256'
require 'jwe/enc/a192cbc_hs384'
require 'jwe/enc/a256cbc_hs512'
require 'jwe/enc/a128gcm'
require 'jwe/enc/a192gcm'
require 'jwe/enc/a256gcm'

module JWE
  module Enc
    def self.for(enc)
      klass = enc.gsub(/[-\+]/, '_').downcase.sub(/^[a-z\d]*/) { $&.capitalize }
      klass.gsub!(/_([a-z\d]*)/i) { $1.capitalize }
      const_get(klass)

    rescue NameError
      raise NotImplementedError.new("Unsupported enc type: #{enc}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jwe-0.1.0 lib/jwe/enc.rb