Class: Xcov::Line

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(execution_count, executable, ranges = nil) ⇒ Line

Returns a new instance of Line.



8
9
10
11
12
# File 'lib/xcov/model/line.rb', line 8

def initialize(execution_count, executable, ranges = nil)
  @execution_count = execution_count
  @executable = executable
  @ranges = ranges
end

Instance Attribute Details

#executableObject (readonly)

Returns the value of attribute executable.



5
6
7
# File 'lib/xcov/model/line.rb', line 5

def executable
  @executable
end

#execution_countObject (readonly)

Returns the value of attribute execution_count.



4
5
6
# File 'lib/xcov/model/line.rb', line 4

def execution_count
  @execution_count
end

#rangesObject (readonly)

Returns the value of attribute ranges.



6
7
8
# File 'lib/xcov/model/line.rb', line 6

def ranges
  @ranges
end

Class Method Details

.map(dictionary) ⇒ Object

Class methods



20
21
22
23
# File 'lib/xcov/model/line.rb', line 20

def self.map(dictionary)
  ranges = map_ranges(dictionary["ranges"])
  Line.new(dictionary["executionCount"], dictionary["executable"], ranges)
end

.map_ranges(dictionaries) ⇒ Object



25
26
27
28
# File 'lib/xcov/model/line.rb', line 25

def self.map_ranges(dictionaries)
  return nil if dictionaries.nil?
  dictionaries.map { |dictionary| Range.map(dictionary) }
end

Instance Method Details

#covered?Boolean

Returns:

  • (Boolean)


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

def covered?
  execution_count > 0
end