Class: Chef::EventDispatch::EventsOutputStream

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/event_dispatch/events_output_stream.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(events, options = {}) ⇒ EventsOutputStream

This is a fake stream that connects to events.

Arguments

events: the EventDispatch object to send data to (run_context.events) options is a hash with these possible options:

  • name: a string that identifies the stream to the user. Preferably short.



11
12
13
14
15
# File 'lib/chef/event_dispatch/events_output_stream.rb', line 11

def initialize(events, options = {})
  @events = events
  @options = options
  events.stream_opened(self, options)
end

Instance Attribute Details

#eventsObject (readonly)

Returns the value of attribute events.



18
19
20
# File 'lib/chef/event_dispatch/events_output_stream.rb', line 18

def events
  @events
end

#optionsObject (readonly)

Returns the value of attribute options.



17
18
19
# File 'lib/chef/event_dispatch/events_output_stream.rb', line 17

def options
  @options
end

Instance Method Details

#<<(str) ⇒ Object



24
25
26
# File 'lib/chef/event_dispatch/events_output_stream.rb', line 24

def <<(str)
  events.stream_output(self, str, options)
end

#closeObject



32
33
34
# File 'lib/chef/event_dispatch/events_output_stream.rb', line 32

def close
  events.stream_closed(self, options)
end


20
21
22
# File 'lib/chef/event_dispatch/events_output_stream.rb', line 20

def print(str)
  events.stream_output(self, str, options)
end

#write(str) ⇒ Object



28
29
30
# File 'lib/chef/event_dispatch/events_output_stream.rb', line 28

def write(str)
  events.stream_output(self, str, options)
end