Class: RSpec::Core::Formatters::DeprecationFormatter::FileStream

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/deprecation_formatter.rb

Overview

Wraps a File object and provides file-specific operations.

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ FileStream

Returns a new instance of FileStream.



197
198
199
200
201
202
203
204
205
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/deprecation_formatter.rb', line 197

def initialize(file)
  @file = file

  # In one of my test suites, I got lots of duplicate output in the
  # deprecation file (e.g. 200 of the same deprecation, even though
  # the `puts` below was only called 6 times). Setting `sync = true`
  # fixes this (but we really have no idea why!).
  @file.sync = true
end

Instance Method Details

#puts(*args) ⇒ Object



207
208
209
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/deprecation_formatter.rb', line 207

def puts(*args)
  @file.puts(*args)
end

#summarize(summary_stream, deprecation_count) ⇒ Object



211
212
213
214
215
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/deprecation_formatter.rb', line 211

def summarize(summary_stream, deprecation_count)
  path = @file.respond_to?(:path) ? @file.path : @file.inspect
  summary_stream.puts "\n#{Helpers.pluralize(deprecation_count, 'deprecation')} logged to #{path}"
  puts RAISE_ERROR_CONFIG_NOTICE
end