Class: Opticon::Notifier::IOStream
- Inherits:
-
Object
- Object
- Opticon::Notifier::IOStream
- Defined in:
- lib/opticon/notifier.rb
Overview
Prints failures to an output stream. By default failures are sent to $stderr, but this can be changed using the :output_stream configuration option.
Instance Attribute Summary collapse
-
#output_stream ⇒ Object
Returns the value of attribute output_stream.
Instance Method Summary collapse
-
#initialize(output_stream = $stderr, options = {}) ⇒ IOStream
constructor
A new instance of IOStream.
- #notify(failures) ⇒ Object
Constructor Details
#initialize(output_stream = $stderr, options = {}) ⇒ IOStream
Returns a new instance of IOStream.
63 64 65 |
# File 'lib/opticon/notifier.rb', line 63 def initialize(output_stream = $stderr, = {}) @output_stream = output_stream end |
Instance Attribute Details
#output_stream ⇒ Object
Returns the value of attribute output_stream.
61 62 63 |
# File 'lib/opticon/notifier.rb', line 61 def output_stream @output_stream end |
Instance Method Details
#notify(failures) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/opticon/notifier.rb', line 67 def notify(failures) if ARGV.include?("-v") puts "Printing #{failures.size} failures to #{output_stream}:" failures.each{|f| puts " #{f.}"} end failures.each do |f| # TODO: make output format configurable output_stream.puts "#{Time.now} :: #{f.uri} :: #{f.}" end end |