lib/milestoner/configuration/transformers/gems/description.rb in milestoner-17.11.0 vs lib/milestoner/configuration/transformers/gems/description.rb in milestoner-18.0.0

- old
+ new

@@ -1,27 +1,33 @@ # frozen_string_literal: true require "dry/monads" require "pathname" +require "refinements/hash" module Milestoner module Configuration module Transformers module Gems # Conditionally updates project description based on specification summary. class Description include Import[:spec_loader] include Dry::Monads[:result] + using Refinements::Hash + def initialize(key = :project_description, path: "#{Pathname.pwd.basename}.gemspec", **) @key = key @path = path super(**) end def call attributes - attributes.fetch(key) { spec_loader.call(path).summary } - .then { |value| Success attributes.merge!(key => value) } + attributes.fetch key do + attributes.merge!(key => spec_loader.call(path).summary).compress! + end + + Success attributes end private attr_reader :key, :path