Class: RailsLens::Mailer::Annotator
- Inherits:
-
Object
- Object
- RailsLens::Mailer::Annotator
- Defined in:
- lib/rails_lens/mailer/annotator.rb
Overview
Handles adding mailer annotations to mailer files
Instance Method Summary collapse
-
#annotate_all(pattern: '**/*_mailer.rb', exclusion: 'vendor/**/*_mailer.rb') ⇒ Set<String>
Annotate all mailer files with mailer information.
-
#initialize(dry_run: false) ⇒ Annotator
constructor
A new instance of Annotator.
-
#remove_all(pattern: '**/*_mailer.rb', exclusion: 'vendor/**/*_mailer.rb') ⇒ Set<String>
Remove mailer annotations from all mailer files.
Constructor Details
Instance Method Details
#annotate_all(pattern: '**/*_mailer.rb', exclusion: 'vendor/**/*_mailer.rb') ⇒ Set<String>
Annotate all mailer files with mailer information
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rails_lens/mailer/annotator.rb', line 18 def annotate_all(pattern: '**/*_mailer.rb', exclusion: 'vendor/**/*_mailer.rb') # Simply annotate all mailer files we found via their source locations source_paths_map.each do |source_path, methods| # Skip vendor files or files matching exclusion pattern next if exclusion && source_path.include?('vendor/') annotate_file(path: source_path, methods: methods) if File.exist?(source_path) end @changed_files end |
#remove_all(pattern: '**/*_mailer.rb', exclusion: 'vendor/**/*_mailer.rb') ⇒ Set<String>
Remove mailer annotations from all mailer files
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rails_lens/mailer/annotator.rb', line 35 def remove_all(pattern: '**/*_mailer.rb', exclusion: 'vendor/**/*_mailer.rb') # Remove annotations from all mailer files we found via their source locations source_paths_map.each_key do |source_path| # Skip vendor files or files matching exclusion pattern next if exclusion && source_path.include?('vendor/') remove_annotations_from_file(source_path) if File.exist?(source_path) end @changed_files end |