class Renamespace::MoveAndRenamespaceSourceFile
Attributes
no_superclass_prefixing[R]
paths[R]
Public Class Methods
new(paths:, no_superclass_prefixing:)
click to toggle source
# File lib/renamespace/move_and_renamespace_source_file.rb, line 8 def initialize(paths:, no_superclass_prefixing:) @paths = paths @no_superclass_prefixing = no_superclass_prefixing end
Public Instance Methods
call()
click to toggle source
# File lib/renamespace/move_and_renamespace_source_file.rb, line 13 def call log_source_and_destination_namespaces write_new_file delete_old_file end
Private Instance Methods
delete_old_file()
click to toggle source
# File lib/renamespace/move_and_renamespace_source_file.rb, line 32 def delete_old_file File.delete(paths.source) unless paths.same? end
log_source_and_destination_namespaces()
click to toggle source
# File lib/renamespace/move_and_renamespace_source_file.rb, line 23 def log_source_and_destination_namespaces puts '%s -> %s' % [paths.source_namespace, paths.destination_namespace] end
renamespaced_file_content()
click to toggle source
# File lib/renamespace/move_and_renamespace_source_file.rb, line 36 def renamespaced_file_content content = File.read(paths.source) Renamespace::RenamespaceFileContent.new( paths: paths, no_superclass_prefixing: no_superclass_prefixing, ).call(content) end
write_new_file()
click to toggle source
# File lib/renamespace/move_and_renamespace_source_file.rb, line 27 def write_new_file Renamespace::Directories.create_directories_to_file(paths.destination) File.write(paths.destination, renamespaced_file_content) end