Class: Nitra::Progress

Inherits:
Object
  • Object
show all
Defined in:
lib/nitra/progress.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProgress

Returns a new instance of Progress.



4
5
6
7
8
# File 'lib/nitra/progress.rb', line 4

def initialize
  @file_count = @files_completed = @example_count = @failure_count = 0
  @output = ""
  @failure = false
end

Instance Attribute Details

#example_countObject

Returns the value of attribute example_count.



2
3
4
# File 'lib/nitra/progress.rb', line 2

def example_count
  @example_count
end

#failureObject

Returns the value of attribute failure.



2
3
4
# File 'lib/nitra/progress.rb', line 2

def failure
  @failure
end

#failure_countObject

Returns the value of attribute failure_count.



2
3
4
# File 'lib/nitra/progress.rb', line 2

def failure_count
  @failure_count
end

#file_countObject

Returns the value of attribute file_count.



2
3
4
# File 'lib/nitra/progress.rb', line 2

def file_count
  @file_count
end

#files_completedObject

Returns the value of attribute files_completed.



2
3
4
# File 'lib/nitra/progress.rb', line 2

def files_completed
  @files_completed
end

#outputObject

Returns the value of attribute output.



2
3
4
# File 'lib/nitra/progress.rb', line 2

def output
  @output
end

Instance Method Details

#fail(message) ⇒ Object



18
19
20
21
# File 'lib/nitra/progress.rb', line 18

def fail(message)
  self.failure = true
  self.output.concat message
end

#file_progress(examples, failures, failure, text) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/nitra/progress.rb', line 10

def file_progress(examples, failures, failure, text)
  self.files_completed += 1
  self.example_count += examples
  self.failure_count += failures
  self.failure ||= failure
  self.output.concat text
end

#filtered_outputObject



23
24
25
# File 'lib/nitra/progress.rb', line 23

def filtered_output
  output.gsub(/\n\n\n+/, "\n\n")
end