lib/rubysmith/cli/configuration/loader.rb in rubysmith-0.12.0 vs lib/rubysmith/cli/configuration/loader.rb in rubysmith-0.13.0

- old
+ new

@@ -15,21 +15,24 @@ 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 self.call(...) = new(...).call - def initialize content: Content.new, client: CLIENT + def self.with_defaults(now: Time.now) = new(now: now, client: DEFAULTS) + + def initialize now: Time.now, content: Content.new, client: CLIENT + @now = now @content = content @client = client end - def call = content.merge(**client.to_h.flatten_keys) + def call = content.merge(**client.to_h.flatten_keys, now: now) private - attr_reader :content, :client + attr_reader :now, :content, :client end end end end