lib/tocer/rake/tasks.rb in tocer-11.1.0 vs lib/tocer/rake/tasks.rb in tocer-12.0.0
- old
+ new
@@ -1,29 +1,28 @@
# frozen_string_literal: true
require "rake"
require "tocer"
+require "refinements/structs"
module Tocer
module Rake
+ # Provides Rake tasks for convenience.
class Tasks
include ::Rake::DSL
+ using Refinements::Structs
- def self.setup
- new.install
- end
+ def self.setup = new.install
- def initialize configuration: Tocer::Configuration.default, runner: Runner
+ def initialize configuration: CLI::Configuration::Loader.new.call, runner: Runner.new
@configuration = configuration
@runner = runner
end
def install
desc "Add/Update Table of Contents (README)"
task :toc, %i[label includes] do |_task, arguments|
- inputs = {label: arguments[:label], includes: arguments[:includes]}.compact
- updated_configuration = configuration.merge inputs
- runner.new(configuration: updated_configuration.to_h).call
+ runner.call(**configuration.merge(**arguments.to_h).to_h).call
end
end
private