Sha256: a6e1503da33a331fba870e466bfe3e685e2dccfb541f6ebb667002484b0c83b9

Contents?: true

Size: 861 Bytes

Versions: 29

Compression:

Stored size: 861 Bytes

Contents

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

<% namespace do %>
  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 "<%= configuration.project_name %>/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).freeze

      private

      attr_reader :content, :client
    end
  end
<% end %>

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
gemsmith-19.8.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-19.7.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-19.6.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-19.5.2 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-19.5.1 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-19.5.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-19.4.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-19.3.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-19.2.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-19.1.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-19.0.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-18.9.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-18.8.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-18.7.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-18.6.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-18.5.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-18.4.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-18.3.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-18.2.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb
gemsmith-18.1.1 lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb