class Milestoner::Configuration::Transformers::Citations::Description

Conditionally updates project description based on citation details.

Attributes

citation[R]
key[R]
path[R]

Public Class Methods

new(key = :project_description, path: Pathname.pwd.join("CITATION.cff"), citation: CFF::File) click to toggle source
# File lib/milestoner/configuration/transformers/citations/description.rb, line 15
def initialize key = :project_description,
               path: Pathname.pwd.join("CITATION.cff"),
               citation: CFF::File
  @key = key
  @path = path
  @citation = citation
end

Public Instance Methods

call(attributes) click to toggle source
# File lib/milestoner/configuration/transformers/citations/description.rb, line 23
def call attributes
  attributes.fetch key do
    value = citation.open(path).abstract
    attributes.merge! key => value unless value.empty?
  end

  Success attributes
end