Sha256: 9d9fa86e486d9f9926713c6db14886aebc3b4d626467683b7cfc96502626ef07
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true require "pathname" require "refinements/hashes" require "refinements/structs" require "runcom" require "yaml" module Git module Lint module Configuration # Represents the fully assembled Command Line Interface (CLI) configuration. class Loader using ::Refinements::Hashes using ::Refinements::Structs DEFAULTS = YAML.load_file(Pathname(__dir__).join("defaults.yml")).freeze CLIENT = Runcom::Config.new "#{Identity::NAME}/configuration.yml", defaults: DEFAULTS def self.call = new.call def self.with_defaults = new(client: DEFAULTS) def initialize content: Content.new, client: CLIENT, setting: Setting @content = content @client = client @setting = setting end def call client.to_h .then do |defaults| content.merge( **defaults.except(:analyzers).flatten_keys, analyzers: load_analyzer_settings(defaults) ).freeze end end private attr_reader :content, :client, :setting def load_analyzer_settings defaults defaults.fetch(:analyzers).map { |id, body| setting[id:, **body] } end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
git-lint-3.0.2 | lib/git/lint/configuration/loader.rb |
git-lint-3.0.1 | lib/git/lint/configuration/loader.rb |
git-lint-3.0.0 | lib/git/lint/configuration/loader.rb |