Class: Munge::Formatters::Dots

Inherits:
Object
  • Object
show all
Defined in:
lib/munge/formatters/dots.rb

Instance Method Summary collapse

Constructor Details

#initializeDots

Returns a new instance of Dots.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/munge/formatters/dots.rb', line 4

def initialize
  @counts = {
    new:       0,
    changed:   0,
    identical: 0
  }

  @relpaths = {
    new:       [],
    changed:   [],
    identical: []
  }

  @dots = {
    new:       Rainbow("W").green,
    changed:   Rainbow("W").yellow,
    identical: "."
  }

  @total = 0
end

Instance Method Details

#call(_item, relpath, write_status, should_print) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/munge/formatters/dots.rb', line 26

def call(_item, relpath, write_status, should_print)
  @total += 1

  @counts[write_status] += 1

  if should_print
    @relpaths[write_status].push(relpath)
  end

  print @dots[write_status]
end

#doneObject



44
45
46
47
48
49
50
51
52
53
# File 'lib/munge/formatters/dots.rb', line 44

def done
  @done_time = Time.now

  # Print a newline after the line of dots
  puts

  list!

  summary!
end

#startObject



38
39
40
41
42
# File 'lib/munge/formatters/dots.rb', line 38

def start
  @start_time = Time.now

  puts "Building:"
end