Class: WarningSigns::Pattern

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

Class Method Summary collapse

Class Method Details

.for(raw_pattern) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/warning_signs/pattern.rb', line 3

def self.for(raw_pattern)
  if raw_pattern.starts_with?("/") && raw_pattern.ends_with?("/")
    RegexPattern.new(raw_pattern)
  else
    StringPattern.new(raw_pattern)
  end
end