lib/milestoner/configuration/transformers/project/author.rb in milestoner-17.0.0 vs lib/milestoner/configuration/transformers/project/author.rb in milestoner-17.1.0
- old
+ new
@@ -1,27 +1,28 @@
# frozen_string_literal: true
require "dry/monads"
+require "refinements/hash"
module Milestoner
module Configuration
module Transformers
module Project
# Conditionally updates author based on Git user.
class Author
include Import[:git]
include Dry::Monads[:result]
+ using Refinements::Hash
+
def initialize(key = :project_author, **)
@key = key
super(**)
end
def call content
- content.fetch(key) { git.get("user.name", nil).value_or(nil) }
- .tap { |value| content[key] = value if value }
-
- Success content
+ content.fetch_value(key) { git.get("user.name", nil).value_or(nil) }
+ .then { |value| Success content.merge!(key => value) }
end
private
attr_reader :key