Class: SimpleCov::Profiles
- Inherits:
-
Hash
- Object
- Hash
- SimpleCov::Profiles
- Defined in:
- lib/simplecov/profiles.rb,
sig/simplecov.rbs
Overview
Configuration procs loaded with SimpleCov.start :rails and defined with
SimpleCov.profiles.define.
Instance Method Summary collapse
- #autoload_profile(name) ⇒ void
- #define(name) { ... } ⇒ profile_proc
-
#fetch_proc(name) ⇒ profile_proc
Lookup order: already registered via #define, then
require "simplecov/profiles/<name>"for the bundled profiles, thenrequire "simplecov-profile-<name>"for third-party plugin gems. - #load(name) ⇒ void
Instance Method Details
#autoload_profile(name) ⇒ void
This method returns an undefined value.
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/simplecov/profiles.rb', line 31 def autoload_profile(name) require "simplecov/profiles/#{name}" rescue LoadError begin require "simplecov-profile-#{name}" rescue LoadError # Neither a bundled profile nor a plugin gem; `fetch_proc` raises the # user-facing error. end end |
#define(name) { ... } ⇒ profile_proc
7 8 9 10 11 12 |
# File 'lib/simplecov/profiles.rb', line 7 def define(name, &blk) name = name.to_sym raise ConfigurationError, "SimpleCov Profile '#{name}' is already defined" unless self[name].nil? self[name] = blk end |
#fetch_proc(name) ⇒ profile_proc
Lookup order: already registered via #define, then
require "simplecov/profiles/<name>" for the bundled profiles, then
require "simplecov-profile-<name>" for third-party plugin gems.
21 22 23 24 25 26 27 |
# File 'lib/simplecov/profiles.rb', line 21 def fetch_proc(name) name = name.to_sym autoload_profile(name) unless key?(name) return fetch(name) if key?(name) raise ConfigurationError, "Could not find SimpleCov Profile called '#{name}'" end |