Sha256: e6b791e55c9207cfe4a15d5259eebc65c32af1456e80965a7b834d2d96723b13

Contents?: true

Size: 924 Bytes

Versions: 11

Compression:

Stored size: 924 Bytes

Contents

# frozen_string_literal: true

require "pragmater"
require "refinements/structs"

module Rubysmith
  module Extensions
    # Ensures project skeleton has pragmas.
    class Pragmater
      using Refinements::Structs

      def self.call(...) = new(...).call

      def initialize configuration,
                     client: ::Pragmater::Inserter.new,
                     record: ::Pragmater::Configuration::Model.new
        @configuration = configuration
        @client = client
        @record = record
      end

      def call = client.call(settings) && configuration

      private

      attr_reader :configuration, :client, :record

      def settings
        record.merge(root_dir: configuration.project_root)
              .transmute! configuration,
                          comments: :extensions_pragmater_comments,
                          patterns: :extensions_pragmater_patterns
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rubysmith-5.9.0 lib/rubysmith/extensions/pragmater.rb
rubysmith-5.8.1 lib/rubysmith/extensions/pragmater.rb
rubysmith-5.8.0 lib/rubysmith/extensions/pragmater.rb
rubysmith-5.7.0 lib/rubysmith/extensions/pragmater.rb
rubysmith-5.6.0 lib/rubysmith/extensions/pragmater.rb
rubysmith-5.5.0 lib/rubysmith/extensions/pragmater.rb
rubysmith-5.4.0 lib/rubysmith/extensions/pragmater.rb
rubysmith-5.3.0 lib/rubysmith/extensions/pragmater.rb
rubysmith-5.2.0 lib/rubysmith/extensions/pragmater.rb
rubysmith-5.1.0 lib/rubysmith/extensions/pragmater.rb
rubysmith-5.0.1 lib/rubysmith/extensions/pragmater.rb