Class: Milestoner::Configuration::Transformers::Gems::Description

Inherits:
Object
  • Object
show all
Defined in:
lib/milestoner/configuration/transformers/gems/description.rb

Overview

Conditionally updates project description based on specification summary.

Instance Method Summary collapse

Constructor Details

#initialize(key = :project_description, path: "#{Pathname.pwd.basename}.gemspec") ⇒ Description

Returns a new instance of Description.



15
16
17
18
19
# File 'lib/milestoner/configuration/transformers/gems/description.rb', line 15

def initialize(key = :project_description, path: "#{Pathname.pwd.basename}.gemspec", **)
  @key = key
  @path = path
  super(**)
end

Instance Method Details

#call(attributes) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/milestoner/configuration/transformers/gems/description.rb', line 21

def call attributes
  attributes.fetch key do
    value = spec_loader.call(path).summary
    attributes.merge! key => value if value
  end

  Success attributes
end