Class: BulletmarkRepairer::Patcher
- Inherits:
-
Object
- Object
- BulletmarkRepairer::Patcher
- Defined in:
- lib/bulletmark_repairer/patcher.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.execute(notifications:, controller:, action:, loaded_associations:) ⇒ Object
9 10 11 |
# File 'lib/bulletmark_repairer/patcher.rb', line 9 def self.execute(notifications:, controller:, action:, loaded_associations:) new(notifications: notifications, controller: controller, action: action, loaded_associations: loaded_associations).execute end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bulletmark_repairer/patcher.rb', line 13 def execute @markers.each do |_base_class, marker| @associations_builder.build(marker) end @associations_builder.associations.each do |_index, associations| path = "#{Rails.root}/tmp/#{SecureRandom.hex(10)}" FileUtils.mkdir(path) Parser::Runner::RubyRewrite.go(%W[-l #{associations.corrector(path)} -m #{associations.file_name}]) FileUtils.rm_r(path) end end |