Sha256: 095a7fa277a32b862a2dddd2d0a8fa09e35797d27a014ba200531761e22cad5c
Contents?: true
Size: 947 Bytes
Versions: 1
Compression:
Stored size: 947 Bytes
Contents
# frozen_string_literal: true require "cff" require "dry/monads" require "pathname" module Milestoner module Configuration module Transformers module Citations # Conditionally updates project description based on citation details. class Description include Dry::Monads[:result] def initialize key = :project_description, path: Pathname.pwd.join("CITATION.cff"), citation: CFF::File @key = key @path = path @citation = citation end def call(content) = Success process(content) private attr_reader :key, :path, :citation def process content content.fetch(key) { citation.open(path).abstract } .then { |value| String(value).empty? ? content : content.merge!(key => value) } end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
milestoner-17.0.0 | lib/milestoner/configuration/transformers/citations/description.rb |