Sha256: 3a8904b75258beddd030ef4a505048414a5e68b3ae5646f5ed42e1418a01fa11

Contents?: true

Size: 351 Bytes

Versions: 3

Compression:

Stored size: 351 Bytes

Contents

require 'jwe/zip/def'

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jwe-0.3.0 lib/jwe/zip.rb
jwe-0.2.0 lib/jwe/zip.rb
jwe-0.1.1 lib/jwe/zip.rb