class Rubygrep::Matcher
Attributes
options[RW]
regexp[RW]
Public Class Methods
new(regexp, options = {})
click to toggle source
# File lib/rubygrep/matcher.rb, line 5 def initialize(regexp, options = {}) @options = options @regexp = process_with_options(regexp) end
Public Instance Methods
matches?(string_data)
click to toggle source
# File lib/rubygrep/matcher.rb, line 10 def matches?(string_data) regexp.match(string_data[:str]) end
Private Instance Methods
process_with_options(regexp)
click to toggle source
# File lib/rubygrep/matcher.rb, line 16 def process_with_options(regexp) regexp = "^((?!#{regexp}).)*$" if options[:invert_selection] Regexp.compile(regexp, options[:ignore_case]) end