Sha256: 3eb89c609c29899f1068e1c424e8ea9088004322b1a48d5dfb5a3e6e5c6a065f

Contents?: true

Size: 1.13 KB

Versions: 10

Compression:

Stored size: 1.13 KB

Contents

require_relative 'initializer'
require_relative 'base'
require_relative 'ruby'
require_relative 'java'
require_relative 'node'
require_relative 'binary'

module IronWorkerNG
  module Code
    class Creator
      include IronWorkerNG::Code::Initializer::InstanceMethods

      def self.create(*args, &block)
        runtime = IronWorkerNG::Code::Creator.new(*args, &block).runtime || 'ruby'

        IronWorkerNG::Code::Base.registered_types.find { |r| r[:name] == runtime }[:klass].new(*args, &block)
      end

      def initialize(*args, &block)
        initialize_code(*args, &block)
      end

      def name(code_name = nil)
        @name = code_name if code_name

        @name
      end

      def name=(name)
        @name = name
      end

      def runtime(*args)
        @runtime = args[0] if args.length == 1

        @runtime
      end

      def runtime=(runtime)
        @runtime = runtime
      end

      def merge_exec(path, *args)
        @exec = path
      end

      alias :exec :merge_exec

      alias :merge_worker :merge_exec
      alias :worker :merge_worker

      def method_missing(name, *args)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
iron_worker_ng-0.6.8 lib/iron_worker_ng/code/creator.rb
iron_worker_ng-0.6.7 lib/iron_worker_ng/code/creator.rb
iron_worker_ng-0.6.6 lib/iron_worker_ng/code/creator.rb
iron_worker_ng-0.6.5 lib/iron_worker_ng/code/creator.rb
iron_worker_ng-0.6.4 lib/iron_worker_ng/code/creator.rb
iron_worker_ng-0.6.3 lib/iron_worker_ng/code/creator.rb
iron_worker_ng-0.6.2 lib/iron_worker_ng/code/creator.rb
iron_worker_ng-0.6.1 lib/iron_worker_ng/code/creator.rb
iron_worker_ng-0.6.0 lib/iron_worker_ng/code/creator.rb
iron_worker_ng-0.5.1 lib/iron_worker_ng/code/creator.rb