-
# frozen_string_literal: true
-
-
1
module RubyCriticSmallBadge
-
# Class to keep all the valid documentations that are required to build the
-
# badge
-
1
class Configuration
-
# Set up config variables.
-
# rubocop:disable Metrics/MethodLength
-
1
def self.options
-
5
{
-
with_analysers: false,
-
background: '#fff',
-
title_prefix: 'rubycritic',
-
title_background: '#555',
-
title_font: 'Verdana,sans-serif',
-
title_font_color: '#fff',
-
score_background_bad: '#ff0000',
-
score_background_unknown: '#cccc00',
-
score_background_good: '#4dc71f',
-
score_font: 'Verdana,sans-serif',
-
score_font_color: '#fff',
-
font: 'Verdana,sans-serif',
-
font_size: 11,
-
badge_height: 20,
-
badge_width: 200,
-
filename_prefix: 'rubycritic_badge',
-
output_path: 'badges',
-
rounded_border: true,
-
rounded_edge_radius: 3,
-
minimum_score: nil
-
}
-
end
-
# rubocop:enable Metrics/MethodLength
-
-
# set up class variables and getters/setters
-
1
options.each_key do |opt|
-
26
define_method(opt) { instance_variable_get "@#{opt}" }
-
41
define_method("#{opt}=") { |val| instance_variable_set("@#{opt}", val) }
-
end
-
-
1
def initialize(**opts)
-
RubyCriticSmallBadge::Configuration
-
21
.options.merge(opts).each { |opt, v| send(:"#{opt}=", v) }
-
end
-
-
1
def to_hash
-
6
hash = {}
-
6
instance_variables.each do |var|
-
120
hash[var.to_s.delete('@').to_sym] = instance_variable_get(var)
-
end
-
6
hash
-
end
-
end
-
end