Class: Recode::Handler::Base
- Inherits:
-
Object
- Object
- Recode::Handler::Base
- Includes:
- Colsole, Diffing
- Defined in:
- lib/recode/handler/base.rb
Direct Known Subclasses
Instance Method Summary collapse
- #rename_file(source, target) ⇒ Object
- #save_file(file, content) ⇒ Object
- #show_edit(file:, before:, after:) ⇒ Object
- #show_rename(source:, target:) ⇒ Object
Methods included from Diffing
Instance Method Details
#rename_file(source, target) ⇒ Object
19 20 21 22 |
# File 'lib/recode/handler/base.rb', line 19 def rename_file(source, target) FileUtils.mkdir_p File.dirname target FileUtils.mv source, target end |
#save_file(file, content) ⇒ Object
24 25 26 |
# File 'lib/recode/handler/base.rb', line 24 def save_file(file, content) File.write file, content end |
#show_edit(file:, before:, after:) ⇒ Object
13 14 15 16 17 |
# File 'lib/recode/handler/base.rb', line 13 def show_edit(file:, before:, after:) say "\n!txtblu!" + ("_" * terminal_width) say "!txtblu!edit: #{file}" puts diff before, after end |
#show_rename(source:, target:) ⇒ Object
7 8 9 10 11 |
# File 'lib/recode/handler/base.rb', line 7 def show_rename(source:, target:) say "\n!txtpur!" + ("_" * terminal_width) say "!txtpur!rename:" puts diff source, target end |