Sha256: a9b90527ff368754d2519344ab0cab8139736b4a97b4525b95485c38a77370af

Contents?: true

Size: 799 Bytes

Versions: 4

Compression:

Stored size: 799 Bytes

Contents

# frozen_string_literal: true

require "tocer"

module Rubysmith
  module Builders
    module Documentation
      # Builds project skeleton CODE_OF_CONDUCT documentation.
      class Conduct
        def self.call(...) = new(...).call

        def initialize configuration, builder: Builder
          @configuration = configuration
          @builder = builder
        end

        def call
          return unless configuration.build_conduct

          configuration.with(template_path: "%project_name%/CODE_OF_CONDUCT.#{kind}.erb")
                       .then { |updated_configuration| builder.call(updated_configuration).render }
        end

        private

        attr_reader :configuration, :builder

        def kind = configuration.documentation_format || "md"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubysmith-0.16.1 lib/rubysmith/builders/documentation/conduct.rb
rubysmith-0.16.0 lib/rubysmith/builders/documentation/conduct.rb
rubysmith-0.15.0 lib/rubysmith/builders/documentation/conduct.rb
rubysmith-0.14.0 lib/rubysmith/builders/documentation/conduct.rb