Class: RspecProfiling::Collectors::JSON

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_profiling/collectors/json.rb

Constant Summary collapse

KEYS =
%w{
  branch
  commit_hash
  seed
  date
  file
  line_number
  owner_tag
  description
  status
  exception
  time
  query_count
  query_time
  request_count
  request_time
  start_memory
  end_memory
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = RspecProfiling.config) ⇒ JSON

Returns a new instance of JSON.



36
37
38
39
40
# File 'lib/rspec_profiling/collectors/json.rb', line 36

def initialize(config=RspecProfiling.config)
  config.output_file_path ||= 'tmp/spec_benchmarks.json'

  @config = config
end

Class Method Details

.installObject



24
25
26
# File 'lib/rspec_profiling/collectors/json.rb', line 24

def self.install
  # no op
end

.resetObject



32
33
34
# File 'lib/rspec_profiling/collectors/json.rb', line 32

def self.reset
  # no op
end

.uninstallObject



28
29
30
# File 'lib/rspec_profiling/collectors/json.rb', line 28

def self.uninstall
  # no op
end

Instance Method Details

#insert(attributes) ⇒ Object



42
43
44
# File 'lib/rspec_profiling/collectors/json.rb', line 42

def insert(attributes)
  output << merge_attributes_and_events(attributes) + "\n"
end