Sha256: 6705c1fe3400bad27ddc3319936892ec399b65037af4b4d95e49a21cec0a3c45
Contents?: true
Size: 876 Bytes
Versions: 3
Compression:
Stored size: 876 Bytes
Contents
# frozen_string_literal: true require "dry/monads" require "pathname" module Milestoner module Configuration module Transformers module Gems # Conditionally updates project URI based on specification home page URL. class URI include Import[:spec_loader] include Dry::Monads[:result] def initialize(key = :project_uri, path: "#{Pathname.pwd.basename}.gemspec", **) @key = key @path = path super(**) end def call attributes attributes.fetch(key) { spec_loader.call(path).homepage_url } .then { |value| value unless String(value).empty? } .then { |value| Success attributes.merge!(key => value) } end private attr_reader :key, :path end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems