Class: WarningSigns::StringPattern

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_pattern) ⇒ StringPattern

Returns a new instance of StringPattern.



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

def initialize(raw_pattern)
  @pattern = raw_pattern
end

Instance Attribute Details

#patternObject

Returns the value of attribute pattern.



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

def pattern
  @pattern
end

Instance Method Details

#match?(message) ⇒ Boolean

Returns:

  • (Boolean)


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

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