Class: Xcov::Function

Inherits:
Base
  • Object
show all
Defined in:
lib/xcov/model/function.rb

Instance Attribute Summary

Attributes inherited from Base

#coverage, #coverage_color, #displayable_coverage, #id, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#create_coverage_color, #create_displayable_coverage, create_id, #create_summary, template

Constructor Details

#initialize(name, coverage) ⇒ Function

Returns a new instance of Function.



6
7
8
9
10
11
# File 'lib/xcov/model/function.rb', line 6

def initialize (name, coverage)
  @name = CGI::escapeHTML(name)
  @coverage = coverage
  @displayable_coverage = self.create_displayable_coverage
  @coverage_color = self.create_coverage_color
end

Class Method Details

.map(dictionary) ⇒ Object

Class methods



23
24
25
# File 'lib/xcov/model/function.rb', line 23

def self.map (dictionary)
  Function.new(dictionary["name"], dictionary["coverage"])
end

Instance Method Details

#html_valueObject



17
18
19
# File 'lib/xcov/model/function.rb', line 17

def html_value
  Function.template("function").result(binding)
end


13
14
15
# File 'lib/xcov/model/function.rb', line 13

def print_description
  puts "\t\t\t#{@name} (#{@displayable_coverage})"
end