Sha256: d541a8d3136fd3b38d57bb23ca22bc7e0089b9f1b6963f70750525735b108cf0

Contents?: true

Size: 360 Bytes

Versions: 21

Compression:

Stored size: 360 Bytes

Contents

class BlacklistPattern < ActiveRecord::Base
end

class RegexPattern < BlacklistPattern
  def matches?(string)
    string.match(/#{pattern}/)
  end

  def to_s
    "Regex /#{pattern}/"
  end
end

class StringPattern < BlacklistPattern
  def matches?(string)
    string.match(/\b#{Regexp.quote(pattern)}\b/)
  end

  def to_s
    "String '#{pattern}'"
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
typo-3.99.0 app/models/blacklist_pattern.rb
typo-3.99.3 app/models/blacklist_pattern.rb
typo-3.99.1 app/models/blacklist_pattern.rb
typo-3.99.2 app/models/blacklist_pattern.rb
typo-3.99.4 app/models/blacklist_pattern.rb
typo-4.0.0 app/models/blacklist_pattern.rb
typo-4.0.1 app/models/blacklist_pattern.rb
typo-4.0.2 app/models/blacklist_pattern.rb
typo-4.1.1 app/models/blacklist_pattern.rb
typo-4.0.3 app/models/blacklist_pattern.rb
typo-4.1 app/models/blacklist_pattern.rb
typo-5.0.1 app/models/blacklist_pattern.rb
typo-5.0.2 app/models/blacklist_pattern.rb
typo-5.0.3.98.1 app/models/blacklist_pattern.rb
typo-5.0 app/models/blacklist_pattern.rb
typo-5.0.3.98 app/models/blacklist_pattern.rb
typo-5.1.2 app/models/blacklist_pattern.rb
typo-5.1.1 app/models/blacklist_pattern.rb
typo-5.1.3 app/models/blacklist_pattern.rb
typo-5.1.98 app/models/blacklist_pattern.rb