Module: CrazyHarry::Redact
- Included in:
- Base
- Defined in:
- lib/crazy_harry/redact.rb
Defined Under Namespace
Classes: InvalidStripMethod
Constant Summary collapse
- STRIP_METHODS =
%w(strip prune escape whitewash)
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#unsafe ⇒ Object
Returns the value of attribute unsafe.
Instance Method Summary collapse
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
8 9 10 |
# File 'lib/crazy_harry/redact.rb', line 8 def attributes @attributes end |
#tags ⇒ Object
Returns the value of attribute tags.
8 9 10 |
# File 'lib/crazy_harry/redact.rb', line 8 def @tags end |
#unsafe ⇒ Object
Returns the value of attribute unsafe.
8 9 10 |
# File 'lib/crazy_harry/redact.rb', line 8 def unsafe @unsafe end |
Instance Method Details
#redact!(opts = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/crazy_harry/redact.rb', line 14 def redact!(opts = {}) self.unsafe = opts.delete(:unsafe) || opts == {} self. = [opts.delete(:tags)].compact.flatten self.attributes = opts.delete(:attributes) self.text = opts.delete(:text) self.scope = opts.delete(:scope) prune = opts.delete(:prune) self.steps << strip_unsafe if self.unsafe self.steps << unless prune || self. == [] self.steps << if prune run! self end |
#strip! ⇒ Object
10 11 12 |
# File 'lib/crazy_harry/redact.rb', line 10 def strip! fragment.to_text end |