Sha256: b75a1576d6ac6267d7f74eb1aea543d29ac887b67b88a72e7bc49c1bbe387fcf

Contents?: true

Size: 473 Bytes

Versions: 6

Compression:

Stored size: 473 Bytes

Contents

## Filter input by given regular expression -- IKeJI
## 
## Filter input by given regular expression.
## The test will be done with the result of to_s method of the input.
## invert option will invert results(-v option of UNIX grep command).
##
## - module: grep
##   config:
##     regex: "[あ-ん]"
##     invert: false

def grep(config,data)
  regex = Regexp.new(config["regex"])
  invert = config["invert"] || false
  data.select {|i| invert ^ (regex =~ i.to_s) }
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
yapra-0.2.2 legacy_plugins/Filter/grep.rb
yapra-0.2.0 legacy_plugins/Filter/grep.rb
yapra-0.1.3 legacy_plugins/Filter/grep.rb
yapra-0.1.0 legacy_plugins/Filter/grep.rb
yapra-0.1.1 legacy_plugins/Filter/grep.rb
yapra-0.1.2 legacy_plugins/Filter/grep.rb