class Line
Attributes
has_match[R]
highlight[RW]
highlight?[RW]
off[R]
Public Class Methods
new(a, onl = nil, off = nil)
click to toggle source
# File lib/cless/data.rb, line 210 def initialize(a, onl = nil, off = nil) @a, @onl = a, onl @m = [] @has_match = false @off = off @highlight = false end
Public Instance Methods
clear_match()
click to toggle source
# File lib/cless/data.rb, line 242 def clear_match; @has_match = false; @m.clear; end
ignored()
click to toggle source
# File lib/cless/data.rb, line 218 def ignored; false; end
Also aliased as: ignored?
match(pattern)
click to toggle source
onl is the line before any formatting or transformation. If a field doesn't match pattern but old representation does, hilight entire field as a match.
# File lib/cless/data.rb, line 228 def match(pattern) does_match = false @a.each_with_index { |f, i| if m = f.match(pattern) does_match = true @m[i] = m elsif @onl && @onl[i].match(pattern) does_match = true @m[i] = FieldMatch.new(f) end } @has_match = does_match end
matches_at(*args)
click to toggle source
# File lib/cless/data.rb, line 223 def matches_at(*args); @m.values_at(*args); end
onl_at(*args)
click to toggle source
# File lib/cless/data.rb, line 222 def onl_at(*args); (@onl || @a).values_at(*args); end
values_at(*args)
click to toggle source
# File lib/cless/data.rb, line 221 def values_at(*args); @a.values_at(*args); end