Class: Nitra::Progress
- Inherits:
-
Object
- Object
- Nitra::Progress
- Defined in:
- lib/nitra/progress.rb
Instance Attribute Summary collapse
-
#example_count ⇒ Object
Returns the value of attribute example_count.
-
#failure ⇒ Object
Returns the value of attribute failure.
-
#failure_count ⇒ Object
Returns the value of attribute failure_count.
-
#file_count ⇒ Object
Returns the value of attribute file_count.
-
#files_completed ⇒ Object
Returns the value of attribute files_completed.
-
#output ⇒ Object
Returns the value of attribute output.
Instance Method Summary collapse
- #fail(message) ⇒ Object
- #file_progress(examples, failures, failure, text) ⇒ Object
- #filtered_output ⇒ Object
-
#initialize ⇒ Progress
constructor
A new instance of Progress.
Constructor Details
#initialize ⇒ Progress
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_count ⇒ Object
Returns the value of attribute example_count.
2 3 4 |
# File 'lib/nitra/progress.rb', line 2 def example_count @example_count end |
#failure ⇒ Object
Returns the value of attribute failure.
2 3 4 |
# File 'lib/nitra/progress.rb', line 2 def failure @failure end |
#failure_count ⇒ Object
Returns the value of attribute failure_count.
2 3 4 |
# File 'lib/nitra/progress.rb', line 2 def failure_count @failure_count end |
#file_count ⇒ Object
Returns the value of attribute file_count.
2 3 4 |
# File 'lib/nitra/progress.rb', line 2 def file_count @file_count end |
#files_completed ⇒ Object
Returns the value of attribute files_completed.
2 3 4 |
# File 'lib/nitra/progress.rb', line 2 def files_completed @files_completed end |
#output ⇒ Object
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() self.failure = true self.output.concat 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_output ⇒ Object
23 24 25 |
# File 'lib/nitra/progress.rb', line 23 def filtered_output output.gsub(/\n\n\n+/, "\n\n") end |