Class: GemInstaller::OutputListener
- Inherits:
-
Object
- Object
- GemInstaller::OutputListener
- Defined in:
- lib/geminstaller/output_listener.rb
Instance Attribute Summary collapse
-
#output_filter ⇒ Object
writeonly
Sets the attribute output_filter.
Instance Method Summary collapse
-
#initialize ⇒ OutputListener
constructor
A new instance of OutputListener.
- #notify(msg, stream = :stdout) ⇒ Object
- #read ⇒ Object
- #read! ⇒ Object
Constructor Details
#initialize ⇒ OutputListener
Returns a new instance of OutputListener.
8 9 10 11 |
# File 'lib/geminstaller/output_listener.rb', line 8 def initialize @messages = [] @output_filter = nil end |
Instance Attribute Details
#output_filter=(value) ⇒ Object (writeonly)
Sets the attribute output_filter
6 7 8 |
# File 'lib/geminstaller/output_listener.rb', line 6 def output_filter=(value) @output_filter = value end |
Instance Method Details
#notify(msg, stream = :stdout) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/geminstaller/output_listener.rb', line 13 def notify(msg, stream = :stdout) @messages.push(msg) return unless @output_filter if stream == :stdout or stream == :stderr @output_filter.rubygems_output(stream, msg) else raise GemInstaller::GemInstallerError.new("Invalid stream specified: #{@stream}") end end |
#read ⇒ Object
23 24 25 |
# File 'lib/geminstaller/output_listener.rb', line 23 def read @messages.dup end |
#read! ⇒ Object
27 28 29 30 31 |
# File 'lib/geminstaller/output_listener.rb', line 27 def read! = @messages.dup @messages.clear end |