Class: TestProf::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/test_prof/core.rb

Overview

TestProf configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



147
148
149
150
151
152
153
# File 'lib/test_prof/core.rb', line 147

def initialize
  @output = $stdout
  @color = true
  @output_dir = "tmp/test_prof"
  @timestamps = false
  @report_suffix = ENV["TEST_PROF_REPORT"]
end

Instance Attribute Details

#colorObject

IO to write logs



141
142
143
# File 'lib/test_prof/core.rb', line 141

def color
  @color
end

#outputObject

IO to write logs



141
142
143
# File 'lib/test_prof/core.rb', line 141

def output
  @output
end

#output_dirObject

IO to write logs



141
142
143
# File 'lib/test_prof/core.rb', line 141

def output_dir
  @output_dir
end

#report_suffixObject

IO to write logs



141
142
143
# File 'lib/test_prof/core.rb', line 141

def report_suffix
  @report_suffix
end

#timestampsObject

IO to write logs



141
142
143
# File 'lib/test_prof/core.rb', line 141

def timestamps
  @timestamps
end

Instance Method Details

#color?Boolean

Returns:

  • (Boolean)


155
156
157
# File 'lib/test_prof/core.rb', line 155

def color?
  color == true && output.is_a?(IO) && output.tty?
end

#loggerObject



163
164
165
# File 'lib/test_prof/core.rb', line 163

def logger
  @logger ||= Logger.new(output, formatter: Logging::Formatter.new)
end

#timestamps?Boolean

Returns:

  • (Boolean)


159
160
161
# File 'lib/test_prof/core.rb', line 159

def timestamps?
  timestamps == true
end