Class: Silhouette::MethodFinder::MethodPosition

Inherits:
Object
  • Object
show all
Defined in:
lib/silhouette/finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, klass) ⇒ MethodPosition

Returns a new instance of MethodPosition.



6
7
8
9
10
11
# File 'lib/silhouette/finder.rb', line 6

def initialize(name, klass)
  @name = name
  @klass = klass
  @misses = 0
  @loc = 0
end

Instance Attribute Details

#first_lineObject

Returns the value of attribute first_line.



17
18
19
# File 'lib/silhouette/finder.rb', line 17

def first_line
  @first_line
end

#klassObject

Returns the value of attribute klass.



17
18
19
# File 'lib/silhouette/finder.rb', line 17

def klass
  @klass
end

#last_lineObject

Returns the value of attribute last_line.



17
18
19
# File 'lib/silhouette/finder.rb', line 17

def last_line
  @last_line
end

#locObject

Returns the value of attribute loc.



17
18
19
# File 'lib/silhouette/finder.rb', line 17

def loc
  @loc
end

#missesObject

Returns the value of attribute misses.



17
18
19
# File 'lib/silhouette/finder.rb', line 17

def misses
  @misses
end

#nameObject

Returns the value of attribute name.



17
18
19
# File 'lib/silhouette/finder.rb', line 17

def name
  @name
end

Instance Method Details

#coverageObject



19
20
21
22
# File 'lib/silhouette/finder.rb', line 19

def coverage
  loc_hit = @loc - @misses
  ((loc_hit / @loc.to_f) * 100).to_i
end

#totalObject



13
14
15
# File 'lib/silhouette/finder.rb', line 13

def total
  @last_line - @first_line
end