Sha256: feae57e2a6c30f8691d8b8fb730d7545a037d2e8c020ba6ba798ec148e49a8b5

Contents?: true

Size: 858 Bytes

Versions: 17

Compression:

Stored size: 858 Bytes

Contents

# frozen_string_literal: true

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

module SublimeTextKit
  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 "sublime_text_kit/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.flatten_keys)

      private

      attr_reader :content, :client
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sublime_text_kit-14.2.0 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-14.1.2 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-14.1.1 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-14.1.0 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-14.0.0 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-13.5.0 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-13.4.0 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-13.3.0 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-13.2.0 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-13.1.0 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-13.0.1 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-13.0.0 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-12.3.2 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-12.3.1 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-12.3.0 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-12.2.0 lib/sublime_text_kit/configuration/loader.rb
sublime_text_kit-12.1.0 lib/sublime_text_kit/configuration/loader.rb