Class: SimpleCov::Profiles

Inherits:
Hash
  • Object
show all
Defined in:
lib/simplecov/profiles.rb

Overview

Profiles are SimpleCov configuration procs that can be easily loaded using SimpleCov.start :rails and defined using

SimpleCov.profiles.define :foo do
  # SimpleCov configuration here, same as in  SimpleCov.configure
end

Instance Method Summary collapse

Instance Method Details

#define(name, &blk) ⇒ Object

Define a SimpleCov profile:

SimpleCov.profiles.define 'rails' do
  # Same as SimpleCov.configure do .. here
end

15
16
17
18
19
# File 'lib/simplecov/profiles.rb', line 15

def define(name, &blk)
  name = name.to_sym
  raise "SimpleCov Profile '#{name}' is already defined" unless self[name].nil?
  self[name] = blk
end

#load(name) ⇒ Object

Applies the profile of given name on SimpleCov.configure


24
25
26
27
28
# File 'lib/simplecov/profiles.rb', line 24

def load(name)
  name = name.to_sym
  raise "Could not find SimpleCov Profile called '#{name}'" unless has_key?(name)
  SimpleCov.configure(&self[name])
end