Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/splat.rb,
lib/splat/linux_tts.rb,
lib/splat/win32_tts.rb,
lib/splat/darwin_tts.rb,
lib/splat/linux_player.rb,
lib/splat/win32_player.rb,
lib/splat/darwin_player.rb,
lib/splat/win32_os_path.rb,
lib/splat/linux_launcher.rb,
lib/splat/win32_launcher.rb,
lib/splat/darwin_launcher.rb,
lib/splat/linux_clipboard.rb,
lib/splat/win32_clipboard.rb,
lib/splat/darwin_clipboard.rb
Instance Method Summary collapse
- #splat_unsupported ⇒ Object (also: #to_clipboard, #to_speech, #to_launcher, #to_player)
- #to_editor ⇒ Object
Instance Method Details
#splat_unsupported ⇒ Object Also known as: to_clipboard, to_speech, to_launcher, to_player
4 5 6 |
# File 'lib/splat.rb', line 4 def splat_unsupported $stderr.puts 'platform not supported' end |
#to_editor ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/splat.rb', line 14 def to_editor tmp_file = Tempfile.new('splat') tmp_file.close begin File.open(tmp_file.path, 'w') { |out| out.print self } default_editor = Splat.platform == :win32 ? 'notepad' : 'vim' editor = ENV["EDITOR"] || default_editor system("#{editor} #{tmp_file.path}") return unless $?.to_i == 0 File.read(tmp_file.path) ensure tmp_file.unlink end end |