Sha256: 2f2b3c7d5f222f3f0193347e84ee26c6ec70b26da8feed0ea713e0c481cfa17c
Contents?: true
Size: 1002 Bytes
Versions: 6
Compression:
Stored size: 1002 Bytes
Contents
# frozen_string_literal: true require "cff" require "dry/monads" require "pathname" require "refinements/hash" module Milestoner module Configuration module Transformers module Citations # Conditionally updates project description based on citation details. class Description include Dry::Monads[:result] using Refinements::Hash def initialize key = :project_description, path: Pathname.pwd.join("CITATION.cff"), citation: CFF::File @key = key @path = path @citation = citation end def call content content.fetch_value(key) { citation.open(path).abstract } .then { |value| value unless String(value).empty? } .then { |value| Success content.merge!(key => value) } end private attr_reader :key, :path, :citation end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems