Sha256: ff220b149731d74506933e51e51f4ac462206ffad5782e0a7f2080415a5bbe70

Contents?: true

Size: 522 Bytes

Versions: 13

Compression:

Stored size: 522 Bytes

Contents

module Killbill
  module Plugin
    class Creator

      attr_reader :target_class_name

      def initialize(target_class_name)
        @target_class_name = target_class_name
      end

      def create(*args)
         real_class = class_from_string
          args.nil? ? real_class.new : real_class.new(*args)
      end

      private

      def class_from_string()
        @target_class_name.split('::').inject(Kernel) do |mod, class_name|
          mod.const_get(class_name)
        end
      end

    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
killbill-1.0.15 lib/killbill/creator.rb
killbill-1.0.14 lib/killbill/creator.rb
killbill-1.0.13 lib/killbill/creator.rb
killbill-1.0.12 lib/killbill/creator.rb
killbill-1.0.11 lib/killbill/creator.rb
killbill-1.0.10 lib/killbill/creator.rb
killbill-1.0.9 lib/killbill/creator.rb
killbill-1.0.8 lib/killbill/creator.rb
killbill-1.0.7 lib/killbill/creator.rb
killbill-1.0.6 lib/killbill/creator.rb
killbill-1.0.5 lib/killbill/creator.rb
killbill-1.0.4 lib/killbill/creator.rb
killbill-1.0.3 lib/killbill/creator.rb