Class: SimpleCovSmallBadge::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/simplecov_small_badge/configuration.rb

Overview

Class to keep all the valid documentations that are required to build the badge

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**opts) ⇒ Configuration

Returns a new instance of Configuration.



42
43
44
45
# File 'lib/simplecov_small_badge/configuration.rb', line 42

def initialize(**opts)
  SimpleCovSmallBadge::Configuration
    .options.merge(opts).each { |opt, v| send(:"#{opt}=", v) }
end

Class Method Details

.optionsObject

Set up config variables. rubocop:disable Metrics/MethodLength



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/simplecov_small_badge/configuration.rb', line 9

def self.options
  {
    with_groups: false,
    background: '#fff',
    title_prefix: 'scov',
    title_background: '#555',
    title_font: 'Verdana,sans-serif',
    font_size: 11,
    title_color: '#fff',
    coverage_background_bad: '#ff0000',
    coverage_background_unknown: '#cccc00',
    coverage_background_good: '#4dc71f',
    coverage_font: 'Verdana,sans-serif',
    coverage_font_color: '#fff',
    coverage_font_size: 11,
    badge_height: 20,
    badge_width: 120,
    filename_prefix: 'coverage_badge',
    output_path: SimpleCov.coverage_path,
    log_level: 'info',
    rounded_border: true,
    rounded_edge_radius: 3,
    percent_sign: '%'
  }
end

Instance Method Details

#to_hashObject



47
48
49
50
51
52
53
# File 'lib/simplecov_small_badge/configuration.rb', line 47

def to_hash
  hash = {}
  instance_variables.each do |var|
    hash[var.to_s.delete('@').to_sym] = instance_variable_get(var)
  end
  hash
end