Sha256: 09913c3eaaff6fe334bd5edb24c4ca76239af5d7a1e32de3bf4bb13bba2f069c

Contents?: true

Size: 773 Bytes

Versions: 7

Compression:

Stored size: 773 Bytes

Contents

# frozen_string_literal: true

require "pathname"
require "refinements/structs"
require "runcom"
require "yaml"

module Tocer
  module CLI
    module Configuration
      # Represents the fully assembled Command Line Interface (CLI) configuration.
      class Loader
        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 initialize content: Content.new, client: CLIENT
          @content = content
          @client = client
        end

        def call = content.merge(**client.to_h)

        private

        attr_reader :content, :client
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tocer-12.2.0 lib/tocer/cli/configuration/loader.rb
tocer-12.1.0 lib/tocer/cli/configuration/loader.rb
tocer-12.0.4 lib/tocer/cli/configuration/loader.rb
tocer-12.0.3 lib/tocer/cli/configuration/loader.rb
tocer-12.0.2 lib/tocer/cli/configuration/loader.rb
tocer-12.0.1 lib/tocer/cli/configuration/loader.rb
tocer-12.0.0 lib/tocer/cli/configuration/loader.rb