Module: Rake::Pipeline::Web::Filters::NeuterWrapper

Defined in:
lib/rake-pipeline-web-filters/neuter_filter.rb

Instance Method Summary collapse

Instance Method Details

#batch(batch) ⇒ Object


50
51
52
53
# File 'lib/rake-pipeline-web-filters/neuter_filter.rb', line 50

def batch(batch)
  @batch = batch
  @batch.required(fullpath)
end

#readObject


55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/rake-pipeline-web-filters/neuter_filter.rb', line 55

def read
  source = super

  required_files = @batch.strip_requires(source).map do |req|
    req_path = @batch.transform_path(req, self)
    if req_path && !@batch.required?(File.expand_path(req_path, root))
      @batch.file_wrapper(self.class, root, req_path, encoding).read
    else
      nil
    end
  end.compact

  file = @batch.filename_comment(self) + @batch.closure_wrap(source)

  (required_files << file).join("\n\n")
end