Class: Rake::Pipeline::RejectMatcher

Inherits:
Matcher show all
Defined in:
lib/rake-pipeline/reject_matcher.rb

Overview

A RejectMatcher is a pipeline that does no processing. It simply filters out some files. You can use this when you have more complex logic that doesn’t fit nicely in a glob.

You can pass a block or a glob (just like DSL#match). Files matching the glob will be rejected from the pipeline. Files are rejected when the block evaluates to true. Specify either a glob or a block.

In general, you should not use RejectMatcher directly. Instead use DSL#reject in the block passed to build.

Constant Summary

Constants inherited from Rake::Pipeline

VERSION

Instance Attribute Summary collapse

Attributes inherited from Matcher

#glob, #pipeline

Attributes inherited from Rake::Pipeline

#filters, #input_files, #inputs, #output_root, #project, #rake_tasks, #tmpdir

Instance Method Summary collapse

Methods inherited from Matcher

#finalize

Methods inherited from Rake::Pipeline

#add_filters, #add_input, build, #build, #copy, #finalize, #fingerprint, #initialize, #invoke, #last_manifest, #manifest, #rake_application, #rake_application=, #setup, #setup_filters

Constructor Details

This class inherits a constructor from Rake::Pipeline

Instance Attribute Details

#blockObject

Returns the value of attribute block.



16
17
18
# File 'lib/rake-pipeline/reject_matcher.rb', line 16

def block
  @block
end

Instance Method Details

#output_filesObject



18
19
20
21
22
23
24
25
26
# File 'lib/rake-pipeline/reject_matcher.rb', line 18

def output_files
  input_files.reject do |file|
    if block
      block.call file
    else
      file.path =~ @pattern
    end
  end
end