Class: Munge::Formatter::Dots

Inherits:
Object
  • Object
show all
Defined in:
lib/munge/formatter/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
# File 'lib/munge/formatter/dots.rb', line 4

def initialize
  @counts = Hash.new { 0 }
  @relpaths = Hash.new { [] }

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

  @total = 0
end

Instance Method Details

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



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/munge/formatter/dots.rb', line 17

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

  @counts[write_status] += 1

  if should_print
    @relpaths[write_status] += [relpath]
  end

  print @dots[write_status]
end

#doneObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/munge/formatter/dots.rb', line 35

def done
  @done_time = Time.now

  # Print a newline after the line of dots
  puts

  list!

  summary!
end

#startObject



29
30
31
32
33
# File 'lib/munge/formatter/dots.rb', line 29

def start
  @start_time = Time.now

  puts "Building:"
end