Skip to content

Commit

Permalink
Use regexp type
Browse files Browse the repository at this point in the history
Signed-off-by: Kenji Okimoto <[email protected]>
  • Loading branch information
okkez committed Apr 5, 2018
1 parent de16030 commit 72cff25
Showing 1 changed file with 4 additions and 28 deletions.
32 changes: 4 additions & 28 deletions lib/fluent/plugin/filter_grep.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,13 @@ def initialize
desc "The field name to which the regular expression is applied."
config_param :key, :string
desc "The regular expression."
config_param :pattern do |value|
if value.start_with?("/") and value.end_with?("/")
Regexp.compile(value[1..-2])
else
Regexp.compile(value)
end
end
config_param :pattern, :regexp
end
config_section :exclude, param_name: :excludes, multi: true do
desc "The field name to which the regular expression is applied."
config_param :key, :string
desc "The regular expression."
config_param :pattern do |value|
if value.start_with?("/") and value.end_with?("/")
Regexp.compile(value[1..-2])
else
Regexp.compile(value)
end
end
config_param :pattern, :regexp
end
end

Expand All @@ -87,25 +75,13 @@ def initialize
desc "The field name to which the regular expression is applied."
config_param :key, :string
desc "The regular expression."
config_param :pattern do |value|
if value.start_with?("/") and value.end_with?("/")
Regexp.compile(value[1..-2])
else
Regexp.compile(value)
end
end
config_param :pattern, :regexp
end
config_section :exclude, param_name: :excludes, multi: true do
desc "The field name to which the regular expression is applied."
config_param :key, :string
desc "The regular expression."
config_param :pattern do |value|
if value.start_with?("/") and value.end_with?("/")
Regexp.compile(value[1..-2])
else
Regexp.compile(value)
end
end
config_param :pattern, :regexp
end
end

Expand Down

0 comments on commit 72cff25

Please sign in to comment.