Class: Coverage::HTMLPrinter::Line

Inherits:
Object
  • Object
show all
Includes:
ERB::Util
Defined in:
lib/coverage/html_printer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lineno, line, count) ⇒ Line

Returns a new instance of Line.



222
223
224
225
226
# File 'lib/coverage/html_printer.rb', line 222

def initialize(lineno, line, count)
  @lineno = lineno
  @line   = line
  @count  = count
end

Instance Attribute Details

#countObject

Returns the value of attribute count.



220
221
222
# File 'lib/coverage/html_printer.rb', line 220

def count
  @count
end

#linenoObject

Returns the value of attribute lineno.



220
221
222
# File 'lib/coverage/html_printer.rb', line 220

def lineno
  @lineno
end

Instance Method Details

#class_nameObject



233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/coverage/html_printer.rb', line 233

def class_name
  case
  when @count.nil?
    'not-code'
  when @count > 0
    'covered'
  when @count == 0
    'uncovered'
  else
    raise "must not happen! count=<#{@count}>"
  end
end

#lineObject



228
229
230
231
# File 'lib/coverage/html_printer.rb', line 228

def line
  return "&#x200c;\n" if @line.chomp.size == 0
  h(@line).gsub(/ /, '&nbsp;')
end