Class: Renamespace::RenameWithinAllFiles
- Inherits:
-
Object
- Object
- Renamespace::RenameWithinAllFiles
- Defined in:
- lib/renamespace/rename_within_all_files.rb
Instance Attribute Summary collapse
-
#can_omit_prefixes_count ⇒ Object
readonly
Returns the value of attribute can_omit_prefixes_count.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(paths:, can_omit_prefixes_count:) ⇒ RenameWithinAllFiles
constructor
A new instance of RenameWithinAllFiles.
Constructor Details
#initialize(paths:, can_omit_prefixes_count:) ⇒ RenameWithinAllFiles
Returns a new instance of RenameWithinAllFiles.
9 10 11 12 |
# File 'lib/renamespace/rename_within_all_files.rb', line 9 def initialize(paths:, can_omit_prefixes_count:) @paths = paths @can_omit_prefixes_count = can_omit_prefixes_count end |
Instance Attribute Details
#can_omit_prefixes_count ⇒ Object (readonly)
Returns the value of attribute can_omit_prefixes_count.
22 23 24 |
# File 'lib/renamespace/rename_within_all_files.rb', line 22 def can_omit_prefixes_count @can_omit_prefixes_count end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/renamespace/rename_within_all_files.rb', line 14 def call Renamespace::Paths.all_ruby_file_paths.each do |path| content_orig = File.read(path) content_new = rename_within_file_content(content_orig) File.write(path, content_new) unless content_orig == content_new end end |