Sha256: c7e2b28cd84d57881a27d79119bef8e24eadc81b70a4bad3490a3bcad153ec48

Contents?: true

Size: 698 Bytes

Versions: 3

Compression:

Stored size: 698 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"

module Milestoner
  module Configuration
    module Transformers
      module URI
        Commit = lambda do |attributes, key = :commit_uri|
          uri, owner, name, domain = attributes.values_at key,
                                                          :project_owner,
                                                          :project_name,
                                                          :commit_domain

          return Dry::Monads::Success attributes unless uri

          attributes[key] = format uri, domain:, owner:, name:, id: "%<id>s"
          Dry::Monads::Success attributes
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
milestoner-17.11.0 lib/milestoner/configuration/transformers/uri/commit.rb
milestoner-17.10.0 lib/milestoner/configuration/transformers/uri/commit.rb
milestoner-17.9.0 lib/milestoner/configuration/transformers/uri/commit.rb