Class: Wukong::Processor::NotRegexpFilter

Inherits:
RegexpFilter show all
Defined in:
lib/wukong/widget/filters.rb

Overview

A widget which only passes records if they don't match a regular expression.

Examples:

Passing records which don't match a given expression on the command-line


$ cat input
apple
banana
cat
$ cat input | wu-local not_regexp --match='^a'
banana
cat

Passing records which don't match a given expression in a dataflow


Wukong.dataflow(:uses_not_regexp) do
  ... | not_regexp(match: /^a/) | ...
end

See Also:

Constant Summary

Constants inherited from Wukong::Processor

SerializerError

Instance Method Summary collapse

Methods inherited from Filter

#process, #reject?

Methods inherited from Wukong::Processor

configure, consumes, description, #expected_record_type, #expected_serialization, #finalize, #perform_action, #process, produces, #receive_action, #setup, #stop, valid_serializer?, validate_and_set_serialization

Methods included from Logging

included

Methods included from Hanuman::StageClassMethods

#builder, #label, #register, #set_builder

Instance Method Details

#select?(record) ⇒ true, false

Select a record only if it doesn't match this widget's match field.

Parameters:

  • record (Object)

Returns:

  • (true, false)


199
200
201
202
# File 'lib/wukong/widget/filters.rb', line 199

def select?(record)
  return true unless match
  not match =~ record.to_s
end