Class: Scrubber::Match
- Inherits:
-
Struct
- Object
- Struct
- Scrubber::Match
- Defined in:
- lib/scrubber/match.rb,
sig/scrubber_rb.rbs
Overview
One thing the engine found, without the thing itself.
begin and end are character offsets into the string you passed, so
text[match.begin...match.end] gives you the raw value back if you really
want it. preview is already masked — it exists so you can log "we found an
email here" without logging the email.
Instance Attribute Summary collapse
-
#begin ⇒ Object
Returns the value of attribute begin.
-
#end ⇒ Object
Returns the value of attribute end.
-
#preview ⇒ Object
Returns the value of attribute preview.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #inspect ⇒ Object (also: #to_s)
-
#length ⇒ Integer
Length of the match in characters.
-
#to_range ⇒ Range[Integer]
The span as a Range, ready for
String#[].
Instance Attribute Details
#begin ⇒ Object
Returns the value of attribute begin
10 11 12 |
# File 'lib/scrubber/match.rb', line 10 def begin @begin end |
#end ⇒ Object
Returns the value of attribute end
10 11 12 |
# File 'lib/scrubber/match.rb', line 10 def end @end end |
#preview ⇒ Object
Returns the value of attribute preview
10 11 12 |
# File 'lib/scrubber/match.rb', line 10 def preview @preview end |
#type ⇒ Object
Returns the value of attribute type
10 11 12 |
# File 'lib/scrubber/match.rb', line 10 def type @type end |
Instance Method Details
#inspect ⇒ Object Also known as: to_s
21 22 23 24 |
# File 'lib/scrubber/match.rb', line 21 def inspect "#<Scrubber::Match type=#{type.inspect} #{self.begin}...#{self.end} " \ "preview=#{preview.inspect}>" end |
#length ⇒ Integer
Length of the match in characters.
17 18 19 |
# File 'lib/scrubber/match.rb', line 17 def length self.end - self.begin end |
#to_range ⇒ Range[Integer]
The span as a Range, ready for String#[].
12 13 14 |
# File 'lib/scrubber/match.rb', line 12 def to_range self.begin...self.end end |