Class: Cucumber::Formatter::Message
- Inherits:
-
Object
- Object
- Cucumber::Formatter::Message
- Includes:
- Io
- Defined in:
- lib/cucumber/formatter/message.rb
Overview
The formatter used for --format message
Instance Method Summary collapse
-
#initialize(config) ⇒ Message
constructor
A new instance of Message.
- #output_envelope(event) ⇒ Object
Methods included from Io
ensure_dir, ensure_file, ensure_io, included, io?, url?
Constructor Details
#initialize(config) ⇒ Message
Returns a new instance of Message.
12 13 14 15 16 17 |
# File 'lib/cucumber/formatter/message.rb', line 12 def initialize(config) @io = ensure_io(config.out_stream, config.error_stream) @repository = Cucumber::Repository.new @query = Cucumber::Query.new(@repository) config.on_event :envelope, &method(:output_envelope) end |
Instance Method Details
#output_envelope(event) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/cucumber/formatter/message.rb', line 19 def output_envelope(event) envelope = event.envelope @repository.update(envelope) @io.write(envelope.to_json) @io.write("\n") end |