Class: RubyNext::Commands::Nextify::Stats

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-next/commands/nextify.rb

Instance Method Summary collapse

Constructor Details

#initializeStats

Returns a new instance of Stats.



14
15
16
17
18
19
# File 'lib/ruby-next/commands/nextify.rb', line 14

def initialize
  @started_at = ::Process.clock_gettime(Process::CLOCK_MONOTONIC)
  @files = 0
  @scans = 0
  @transpiled_files = 0
end

Instance Method Details

#file!Object



21
22
23
# File 'lib/ruby-next/commands/nextify.rb', line 21

def file!
  @files += 1
end

#reportObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/ruby-next/commands/nextify.rb', line 33

def report
  <<~TXT

    Files processed: #{@files}
    Total scans: #{@scans}
    Files transpiled: #{@transpiled_files}

    Completed in #{::Process.clock_gettime(Process::CLOCK_MONOTONIC) - @started_at}s
  TXT
end

#scan!Object



25
26
27
# File 'lib/ruby-next/commands/nextify.rb', line 25

def scan!
  @scans += 1
end

#transpiled!Object



29
30
31
# File 'lib/ruby-next/commands/nextify.rb', line 29

def transpiled!
  @transpiled_files += 1
end