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, current) ⇒ 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, current) records_to_save = [] current.each do |record| found = existing.find { _1.path == record.path } records_to_save << if found.nil? || record.revision != found.revision record else record + found 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 |
# File 'lib/cover_rage/record.rb', line 19 def +(other) with( execution_count: execution_count.map.with_index do |item, index| item.nil? ? nil : item + other.execution_count[index] end, last_executed_at: last_executed_at.map.with_index do |item, index| if item.nil? && other.last_executed_at[index].nil? then nil elsif item.nil? then other.last_executed_at[index] elsif other.last_executed_at[index].nil? then item else [item, other.last_executed_at[index]].max end end ) end |