Sha256: 592e89665a74b6bafbaf5a8fb71b716663c6bbf5163006c913cd5df3321b4345
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
module VER class Executor # Open or focus a buffer with the given path. class ExPath < Entry def choices(origin) origin = origin.sub(/^.*\/\//, '/') origin = origin.sub(/^.*\/~\//, '~/') origin = File.expand_path(origin) unless File.directory?(origin) Dir.glob("#{origin}*").map do |path| if File.directory?(path) "#{path}/" else path end end end def action(selected) path = selected || value throw(:invalid) if File.directory?(path) VER.find_or_create_buffer(path) callback.destroy(false) end end # Create new buffer with given filename and copy contents of current buffer # into it. # Then save it for good measure. class ExWrite < ExPath def action(selected) path = selected || value throw(:invalid) if File.directory?(path) VER.find_or_create_buffer(path) do |buffer| text = buffer.text text.value = caller.value.chomp Methods::Save.file_save(text) end callback.destroy(false) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ver-2010.08 | lib/ver/executor/path.rb |
ver-2010.02 | lib/ver/executor/path.rb |