class Milestoner::Configuration::Transformers::Gems::URI
Conditionally updates project URI
based on specification home page URL.
Attributes
Public Class Methods
Source
# File lib/milestoner/configuration/transformers/gems/uri.rb, line 15 def initialize(key = :project_uri, path: "#{Pathname.pwd.basename}.gemspec", **) super(**) @key = key @path = path end
Calls superclass method
Public Instance Methods
Source
# File lib/milestoner/configuration/transformers/gems/uri.rb, line 21 def call attributes process attributes Success attributes rescue KeyError => error Failure step: :transform, payload: "Unable to transform #{key.inspect}, missing specifier: " \ "\"#{error.message[/<.+>/]}\"." end
Private Instance Methods
Source
# File lib/milestoner/configuration/transformers/gems/uri.rb, line 34 def process attributes attributes.fetch(key) { spec_loader.call(path).homepage_url } .then { |value| value.match?(/%<.+>s/) ? format(value, attributes) : value } .then { |value| attributes.merge! key => value unless value.empty? } end