• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

halostatue / diff-lcs / 14435601054

14 Apr 2025 01:36AM UTC coverage: 88.598%. Remained the same
14435601054

Pull #137

github

web-flow
Merge 3682b8a78 into 092281f97
Pull Request #137: Bump ruby/setup-ruby from 1.229.0 to 1.230.0

533 of 797 branches covered (66.88%)

676 of 763 relevant lines covered (88.6%)

288.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/lib/diff/lcs/block.rb
1
# frozen_string_literal: true
2

3
# A block is an operation removing, adding, or changing a group of items.
4
# Basically, this is just a list of changes, where each change adds or
5
# deletes a single item. Used by bin/ldiff.
6
class Diff::LCS::Block
2✔
7
  attr_reader :changes, :insert, :remove
2✔
8

9
  def initialize(chunk)
2✔
10
    @changes = []
20✔
11
    @insert = []
20✔
12
    @remove = []
20✔
13

14
    chunk.each do |item|
20✔
15
      @changes << item
42✔
16
      @remove << item if item.deleting?
42✔
17
      @insert << item if item.adding?
42✔
18
    end
19
  end
20

21
  def diff_size
2✔
22
    @insert.size - @remove.size
40✔
23
  end
24

25
  def op
2✔
26
    case [@remove.empty?, @insert.empty?]
10!
27
    when [false, false]
5✔
28
      "!"
10✔
29
    when [false, true]
×
30
      "-"
×
31
    when [true, false]
×
32
      "+"
×
33
    else # [true, true]
×
34
      "^"
×
35
    end
36
  end
37
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc