class MMVE::Editor
Public Class Methods
new(editor_command)
click to toggle source
# File lib/mmve/editor.rb, line 5 def initialize editor_command @editor_command = editor_command end
Public Instance Methods
edit(paths)
click to toggle source
# File lib/mmve/editor.rb, line 9 def edit paths edited_content = with_temp_file(paths * $/ + $/) { |f| edit_file f } edited_content.split $/ end
edit_file(file)
click to toggle source
# File lib/mmve/editor.rb, line 25 def edit_file file system *@editor_command.split, file.path end
with_temp_file(content) { |f| ... }
click to toggle source
# File lib/mmve/editor.rb, line 14 def with_temp_file content content_after = '' Tempfile.open File.basename $0 + ?_ do |f| f.write content f.rewind yield f content_after = f.read end content_after end