Class: SiteDiff::Sanitizer::Regexp
- Inherits:
-
Object
- Object
- SiteDiff::Sanitizer::Regexp
- Defined in:
- lib/sitediff/sanitize/regexp.rb
Direct Known Subclasses
Defined Under Namespace
Classes: WithSelector
Class Method Summary collapse
Instance Method Summary collapse
- #applies?(html, _node) ⇒ Boolean
- #apply(html) ⇒ Object
-
#initialize(rule) ⇒ Regexp
constructor
A new instance of Regexp.
- #selector? ⇒ Boolean
Constructor Details
#initialize(rule) ⇒ Regexp
Returns a new instance of Regexp.
6 7 8 |
# File 'lib/sitediff/sanitize/regexp.rb', line 6 def initialize(rule) @rule = rule end |
Class Method Details
.create(rule) ⇒ Object
22 23 24 |
# File 'lib/sitediff/sanitize/regexp.rb', line 22 def self.create(rule) rule['selector'] ? WithSelector.new(rule) : new(rule) end |
Instance Method Details
#applies?(html, _node) ⇒ Boolean
14 15 16 |
# File 'lib/sitediff/sanitize/regexp.rb', line 14 def applies?(html, _node) applies_to_string?(html) end |
#apply(html) ⇒ Object
18 19 20 |
# File 'lib/sitediff/sanitize/regexp.rb', line 18 def apply(html) gsub!(html) end |
#selector? ⇒ Boolean
10 11 12 |
# File 'lib/sitediff/sanitize/regexp.rb', line 10 def selector? false end |