Sha256: 466169019a5f271323cd84a5d03c833d10bd332a7e3002c19b127f15787db285
Contents?: true
Size: 595 Bytes
Versions: 14
Compression:
Stored size: 595 Bytes
Contents
require 'tempfile' require 'shellwords' module T class Editor class << self def gets file = tempfile edit(file.path) File.read(file).strip ensure file.close file.unlink end def tempfile Tempfile.new('TWEET_EDITMSG') end def edit(path) system(Shellwords.join([editor, path])) end def editor ENV['VISUAL'] || ENV['EDITOR'] || system_editor end def system_editor RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'notepad' : 'vi' end end end end
Version data entries
14 entries across 14 versions & 1 rubygems