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 Attribute Summary

Attributes included from Hanuman::StageInstanceMethods

#graph

Instance Method Summary collapse

Methods inherited from Filter

#process, #reject?

Methods inherited from Wukong::Processor

configure, description, #finalize, #perform_action, #process, #receive_action, #setup, #stop

Methods included from Logging

included

Methods inherited from Hanuman::Stage

#clone

Methods included from Hanuman::StageClassMethods

#builder, #label, #register, #set_builder

Methods included from Hanuman::StageInstanceMethods

#add_link, #linkable_name, #root

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