Sha256: 2916a0f8b3b5f411ce33f7a33f8ad2ccf6c5df5862655cf6f03c552d31c204af

Contents?: true

Size: 1.14 KB

Versions: 15

Compression:

Stored size: 1.14 KB

Contents

module IronWorkerNG
  module Feature
    module Node
      module MergeWorker
        class Feature < IronWorkerNG::Feature::Base
          attr_reader :path

          def initialize(path)
            @path = File.expand_path(path)
          end

          def hash_string
            Digest::MD5.hexdigest(@path + File.mtime(@path).to_i.to_s)
          end

          def bundle(zip)
            zip.add(File.basename(@path), @path)
          end

          def code_for_init
            "worker_file_name = '#{File.basename(@path)}'"
          end
        end

        module InstanceMethods
          attr_reader :worker

          def merge_worker(path)
            @worker ||= nil 

            return unless @worker.nil?

            @name ||= File.basename(path).gsub(/\.js$/, '').capitalize.gsub(/_./) { |x| x[1].upcase }

            @worker = IronWorkerNG::Feature::Node::MergeWorker::Feature.new(path)
            @features << @worker
          end

          def self.included(base)
            IronWorkerNG::Code::Base.register_feature(:name => 'merge_worker', :for_klass => base, :args => 'PATH')
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
iron_worker_ng-0.1.14 lib/iron_worker_ng/feature/node/merge_worker.rb
iron_worker_ng-0.1.13 lib/iron_worker_ng/feature/node/merge_worker.rb
iron_worker_ng-0.1.12 lib/iron_worker_ng/feature/node/merge_worker.rb
iron_worker_ng-0.1.11 lib/iron_worker_ng/feature/node/merge_worker.rb
iron_worker_ng-0.1.10 lib/iron_worker_ng/feature/node/merge_worker.rb
iron_worker_ng-0.1.9 lib/iron_worker_ng/feature/node/merge_worker.rb
iron_worker_ng-0.1.8 lib/iron_worker_ng/feature/node/merge_worker.rb
iron_worker_ng-0.1.7 lib/iron_worker_ng/feature/node/merge_worker.rb
iron_worker_ng-0.1.6 lib/iron_worker_ng/feature/node/merge_worker.rb
iron_worker_ng-0.1.5 lib/iron_worker_ng/feature/node/merge_worker.rb
iron_worker_ng-0.1.4 lib/iron_worker_ng/feature/node/merge_worker.rb
iron_worker_ng-0.1.3 lib/iron_worker_ng/feature/node/merge_worker.rb
iron_worker_ng-0.1.2 lib/iron_worker_ng/feature/node/merge_worker.rb
iron_worker_ng-0.1.1 lib/iron_worker_ng/feature/node/merge_worker.rb
iron_worker_ng-0.1.0 lib/iron_worker_ng/feature/node/merge_worker.rb