Class: Pennyworth::CLI::Configuration::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/pennyworth/cli/configuration/loader.rb

Overview

Represents the fully assembled Command Line Interface (CLI) configuration.

Constant Summary collapse

DEFAULTS =
YAML.load_file(Pathname(__dir__).join("defaults.yml")).freeze
HANDLER =
Runcom::Config.new "#{Identity::NAME}/configuration.yml", defaults: DEFAULTS

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content: Content.new, handler: HANDLER) ⇒ Loader

Returns a new instance of Loader.



24
25
26
27
# File 'lib/pennyworth/cli/configuration/loader.rb', line 24

def initialize content: Content.new, handler: HANDLER
  @content = content
  @handler = handler
end

Class Method Details

.callObject



20
# File 'lib/pennyworth/cli/configuration/loader.rb', line 20

def self.call = new.call

.with_defaultsObject



22
# File 'lib/pennyworth/cli/configuration/loader.rb', line 22

def self.with_defaults = new(handler: DEFAULTS)

Instance Method Details

#callObject



29
# File 'lib/pennyworth/cli/configuration/loader.rb', line 29

def call = content.merge(**handler.to_h.flatten_keys)