Class: Rubysmith::Extensions::Pragmater

Inherits:
Object
  • Object
show all
Defined in:
lib/rubysmith/extensions/pragmater.rb

Overview

Ensures project skeleton has pragmas.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration, client: ::Pragmater::Inserter.new) ⇒ Pragmater

Returns a new instance of Pragmater.



21
22
23
24
# File 'lib/rubysmith/extensions/pragmater.rb', line 21

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

Class Method Details

.callObject



12
# File 'lib/rubysmith/extensions/pragmater.rb', line 12

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

.custom_configurationObject



14
15
16
17
18
19
# File 'lib/rubysmith/extensions/pragmater.rb', line 14

def self.custom_configuration
  ::Pragmater::Configuration::Model[
    comments: ["# frozen_string_literal: true"],
    patterns: %w[**/*.rake **/*.rb *.gemspec exe/* bin/* config.ru *file]
  ]
end

Instance Method Details

#callObject



26
27
28
29
# File 'lib/rubysmith/extensions/pragmater.rb', line 26

def call
  configuration.project_root.change_dir { client.call self.class.custom_configuration }
  configuration
end