Class: Gemsmith::Generators::Pragma
- Defined in:
- lib/gemsmith/generators/pragma.rb
Overview
Formats pragma comments in source files.
Class Method Summary collapse
Instance Method Summary collapse
- #run ⇒ Object
-
#whitelist ⇒ Object
rubocop:disable Metrics/MethodLength.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Gemsmith::Generators::Base
Class Method Details
.comments ⇒ Object
10 11 12 |
# File 'lib/gemsmith/generators/pragma.rb', line 10 def self.comments ["# frozen_string_literal: true"] end |
Instance Method Details
#run ⇒ Object
29 30 31 |
# File 'lib/gemsmith/generators/pragma.rb', line 29 def run whitelisted_files.each { |file| Pragmater::Writer.new(file, self.class.comments).add } end |
#whitelist ⇒ Object
rubocop:disable Metrics/MethodLength
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gemsmith/generators/pragma.rb', line 15 def whitelist %W[ Gemfile Guardfile Rakefile config.ru bin/#{configuration.dig :gem, :name} bin/rails .gemspec .rake .rb ] end |