lib/milestoner/configuration/transformers/project/version.rb in milestoner-17.0.0 vs lib/milestoner/configuration/transformers/project/version.rb in milestoner-17.1.0
- old
+ new
@@ -1,25 +1,27 @@
# frozen_string_literal: true
require "dry/monads"
+require "refinements/hash"
module Milestoner
module Configuration
module Transformers
module Project
# Conditionally updates version based on last Git tag.
class Version
include Dry::Monads[:result]
+ using Refinements::Hash
+
def initialize key = :project_version, versioner: Commits::Versioner.new
@key = key
@versioner = versioner
end
def call content
- content.fetch(key) { versioner.call }
- .then { |value| content.merge! key => value }
- .then { |update| Success update }
+ content.fetch_value(key) { versioner.call }
+ .then { |value| Success content.merge!(key => value) }
end
private
attr_reader :key, :versioner