Sha256: a52bd083416be9a5381920effd6c75dcf18653d24dc65af5ea9a297d4ad9764b

Contents?: true

Size: 787 Bytes

Versions: 1

Compression:

Stored size: 787 Bytes

Contents

require_relative 'asn1_engine/asn1_engine'

require_relative 'asn1_engine/asn1_object'

require_relative 'factory/bin_struct_factory'

module Binenc
  module Ruby
    class Provider
      include TR::CondUtils

      def self.provider_name
        "ruby"
      end

      def self.engine_instance(*args, &block)
        eng = args.first


        if is_empty?(eng)
          ASN1Engine.new(*args[1..-1], &block)
        else

          case eng.to_s.downcase.to_sym
          when :asn1, :asn1_eng
            ASN1Engine.new(*args[1..-1], &block)
          when :bin_struct, :binstruct
            BinStructFactory.instance(*args, &block)
          else
            raise BinencEngineException, "Engine #{eng} is not supported"
          end
        end

      end

    end
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
binenc-ruby-0.1.0 lib/binenc/provider.rb