Sha256: d65c0667cc1dbe73732af145f0e9bc38ddfcc1cb01c214db585f45f2fafd23b1
Contents?: true
Size: 784 Bytes
Versions: 15
Compression:
Stored size: 784 Bytes
Contents
# encoding: utf-8 require 'bitbucket_rest_api/core_ext/hash' module BitBucket class ApiFactory # Instantiates a new bitbucket api object def self.new(klass, options={}) return create_instance(klass, options) if klass raise ArgumentError, 'must provide klass to be instantiated' end # Passes configuration options to instantiated class def self.create_instance(klass, options) options.symbolize_keys! instance = convert_to_constant(klass.to_s).new options BitBucket.api_client = instance instance end def self.convert_to_constant(classes) constant = BitBucket classes.split('::').each do |klass| constant = constant.const_get klass end return constant end end end # BitBucket
Version data entries
15 entries across 15 versions & 4 rubygems