Class: Rubysmith::Extensions::Pragmater

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

Overview

Ensures project skeleton has pragmas.

Constant Summary collapse

CLIENT =
::Pragmater::Inserter.new(
  settings: ::Pragmater::Configuration::Model[
    comments: ["# frozen_string_literal: true"],
    patterns: %w[
      **/*.rake
      **/*.rb
      *.gemspec
      exe/*
      bin/console
      bin/rake
      bin/rspec
      bin/rubocop
      bin/setup
      config.ru
      Gemfile
      Rakefile
    ]
  ]
).freeze

Instance Method Summary collapse

Constructor Details

#initialize(client: CLIENT) ⇒ Pragmater

Returns a new instance of Pragmater.



34
35
36
37
# File 'lib/rubysmith/extensions/pragmater.rb', line 34

def initialize(client: CLIENT, **)
  @client = client
  super(**)
end

Instance Method Details

#callObject



39
40
41
42
43
# File 'lib/rubysmith/extensions/pragmater.rb', line 39

def call
  logger.info { "Adding frozen string literal pragmas..." }
  settings.project_root.change_dir { client.call }
  true
end