Sha256: 087703e5066b0426a2f8e44baffd258acaa84538e0f3033effe3ba36d9714b22

Contents?: true

Size: 764 Bytes

Versions: 16

Compression:

Stored size: 764 Bytes

Contents

# frozen_string_literal: true

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

module Tocer
  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 "tocer/configuration.yml", defaults: DEFAULTS

      def self.call = new.call

      def self.with_defaults = new(client: DEFAULTS)

      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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
tocer-15.2.0 lib/tocer/configuration/loader.rb
tocer-15.1.2 lib/tocer/configuration/loader.rb
tocer-15.1.1 lib/tocer/configuration/loader.rb
tocer-15.1.0 lib/tocer/configuration/loader.rb
tocer-15.0.0 lib/tocer/configuration/loader.rb
tocer-14.5.0 lib/tocer/configuration/loader.rb
tocer-14.4.0 lib/tocer/configuration/loader.rb
tocer-14.3.0 lib/tocer/configuration/loader.rb
tocer-14.2.0 lib/tocer/configuration/loader.rb
tocer-14.1.0 lib/tocer/configuration/loader.rb
tocer-14.0.1 lib/tocer/configuration/loader.rb
tocer-14.0.0 lib/tocer/configuration/loader.rb
tocer-13.3.1 lib/tocer/configuration/loader.rb
tocer-13.3.0 lib/tocer/configuration/loader.rb
tocer-13.2.0 lib/tocer/configuration/loader.rb
tocer-13.1.0 lib/tocer/configuration/loader.rb