Class: OutputStream
- Inherits:
-
Object
- Object
- OutputStream
- Defined in:
- app/models/output_stream.rb
Instance Method Summary collapse
- #<<(value) ⇒ Object
-
#initialize(deploy) ⇒ OutputStream
constructor
A new instance of OutputStream.
- #to_s ⇒ Object
Constructor Details
#initialize(deploy) ⇒ OutputStream
Returns a new instance of OutputStream.
5 6 7 8 |
# File 'app/models/output_stream.rb', line 5 def initialize(deploy) @deploy = deploy @lines = ThreadSafe::Array.new end |
Instance Method Details
#<<(value) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/models/output_stream.rb', line 10 def <<(value) @lines.push(value) begin @deploy.update_column :output, to_s rescue exceptions_wrapping(PG::ConnectionBad) # Be lazy about writing this to the database # Better yet, !todo, debounce this Rails.logger.warn "#{$!.class}: #{$!.}" end self end |
#to_s ⇒ Object
22 23 24 |
# File 'app/models/output_stream.rb', line 22 def to_s @lines.join end |