Class: WarningSigns::RegexPattern

Inherits:
Object
  • Object
show all
Defined in:
lib/warning_signs/regex_pattern.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_pattern) ⇒ RegexPattern

Returns a new instance of RegexPattern.



5
6
7
# File 'lib/warning_signs/regex_pattern.rb', line 5

def initialize(raw_pattern)
  @pattern = Regexp.new(raw_pattern[1...-1])
end

Instance Attribute Details

#patternObject

Returns the value of attribute pattern.



3
4
5
# File 'lib/warning_signs/regex_pattern.rb', line 3

def pattern
  @pattern
end

Instance Method Details

#match?(message) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/warning_signs/regex_pattern.rb', line 9

def match?(message)
  pattern.match?(message)
end