Sha256: f25fa27196973e2b878476ce3bb99c9dc0fb47a1db922c9838f9387601c16e8f

Contents?: true

Size: 698 Bytes

Versions: 5

Compression:

Stored size: 698 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"

module Milestoner
  module Configuration
    module Transformers
      module Generator
        # Conditionally updates generator label based on gem specification.
        class Label
          include Import[:specification]
          include Dry::Monads[:result]

          def initialize(key = :generator_label, **)
            @key = key
            super(**)
          end

          def call content
            content.fetch(key) { specification.labeled_version }
                   .then { |value| Success content.merge!(key => value) }
          end

          private

          attr_reader :key
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
milestoner-17.5.0 lib/milestoner/configuration/transformers/generator/label.rb
milestoner-17.4.0 lib/milestoner/configuration/transformers/generator/label.rb
milestoner-17.3.0 lib/milestoner/configuration/transformers/generator/label.rb
milestoner-17.2.0 lib/milestoner/configuration/transformers/generator/label.rb
milestoner-17.1.0 lib/milestoner/configuration/transformers/generator/label.rb