Class: CoverRage::Record
- Inherits:
-
Data
- Object
- Data
- CoverRage::Record
- Defined in:
- lib/cover_rage/record.rb
Instance Attribute Summary collapse
-
#execution_count ⇒ Object
readonly
Returns the value of attribute execution_count.
-
#last_executed_at ⇒ Object
readonly
Returns the value of attribute last_executed_at.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#execution_count ⇒ Object (readonly)
Returns the value of attribute execution_count
4 5 6 |
# File 'lib/cover_rage/record.rb', line 4 def execution_count @execution_count end |
#last_executed_at ⇒ Object (readonly)
Returns the value of attribute last_executed_at
4 5 6 |
# File 'lib/cover_rage/record.rb', line 4 def last_executed_at @last_executed_at end |
#path ⇒ Object (readonly)
Returns the value of attribute path
4 5 6 |
# File 'lib/cover_rage/record.rb', line 4 def path @path end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision
4 5 6 |
# File 'lib/cover_rage/record.rb', line 4 def revision @revision end |
#source ⇒ Object (readonly)
Returns the value of attribute source
4 5 6 |
# File 'lib/cover_rage/record.rb', line 4 def source @source end |
Class Method Details
.merge(existing_records, current_records) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/cover_rage/record.rb', line 5 def self.merge(existing_records, current_records) records_to_save = [] current_records.each do |current_record| existing_record = existing_records.find { _1.path == current_record.path } records_to_save << if existing_record.nil? || current_record.revision != existing_record.revision current_record else existing_record + current_record end end records_to_save end |
Instance Method Details
#+(other) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cover_rage/record.rb', line 19 def +(other) with( execution_count: execution_count.map.with_index do |item, index| other_item = other.execution_count[index] if item.nil? && other_item.nil? then nil elsif item.nil? || other_item.nil? then other_item else item + other_item end end, last_executed_at: last_executed_at.map.with_index do |item, index| other_item = other.last_executed_at[index] if item.nil? && other_item.nil? then nil elsif item.nil? || other_item.nil? then other_item else [item, other_item].max end end ) end |