Class: IgnoredLine
- Inherits:
-
Object
- Object
- IgnoredLine
- Defined in:
- lib/cless/data.rb
Instance Attribute Summary collapse
-
#has_match ⇒ Object
readonly
Returns the value of attribute has_match.
-
#off ⇒ Object
readonly
Returns the value of attribute off.
-
#str ⇒ Object
readonly
Returns the value of attribute str.
Instance Method Summary collapse
- #clear_match ⇒ Object
-
#highlight ⇒ Object
(also: #highlight?)
An ignored line is never highlighted.
- #highlight=(*args) ⇒ Object
- #ignored ⇒ Object (also: #ignored?)
-
#initialize(str, off) ⇒ IgnoredLine
constructor
A new instance of IgnoredLine.
- #match(pattern) ⇒ Object
- #matches ⇒ Object
Constructor Details
#initialize(str, off) ⇒ IgnoredLine
Returns a new instance of IgnoredLine.
248 249 250 251 252 |
# File 'lib/cless/data.rb', line 248 def initialize(str, off) @str = str @has_match = false @off = off # Byte offset in file of beginning of line end |
Instance Attribute Details
#has_match ⇒ Object (readonly)
Returns the value of attribute has_match.
246 247 248 |
# File 'lib/cless/data.rb', line 246 def has_match @has_match end |
#off ⇒ Object (readonly)
Returns the value of attribute off.
246 247 248 |
# File 'lib/cless/data.rb', line 246 def off @off end |
#str ⇒ Object (readonly)
Returns the value of attribute str.
246 247 248 |
# File 'lib/cless/data.rb', line 246 def str @str end |
Instance Method Details
#clear_match ⇒ Object
262 |
# File 'lib/cless/data.rb', line 262 def clear_match; @has_match = false; @m = nil; end |
#highlight ⇒ Object Also known as: highlight?
An ignored line is never highlighted
268 |
# File 'lib/cless/data.rb', line 268 def highlight; false; end |
#highlight=(*args) ⇒ Object
271 |
# File 'lib/cless/data.rb', line 271 def highlight=(*args); end |
#ignored ⇒ Object Also known as: ignored?
264 |
# File 'lib/cless/data.rb', line 264 def ignored; true; end |
#match(pattern) ⇒ Object
254 255 256 257 258 259 |
# File 'lib/cless/data.rb', line 254 def match(pattern) if m = @str.match(pattern) @m = m @has_match = true end end |
#matches ⇒ Object
261 |
# File 'lib/cless/data.rb', line 261 def matches; @m; end |