Module: Clipboard::File

Extended by:
File
Included in:
File
Defined in:
lib/clipboard/file.rb

Constant Summary collapse

FILE =
File.expand_path("~/.clipboard")

Instance Method Summary collapse

Instance Method Details

#clearObject



17
18
19
# File 'lib/clipboard/file.rb', line 17

def clear
  copy ''
end

#copy(text) ⇒ Object



8
9
10
11
# File 'lib/clipboard/file.rb', line 8

def copy(text)
  File.open(FILE,'w'){|f| f.write(text) } rescue ''
  paste
end

#paste(_ = nil) ⇒ Object



13
14
15
# File 'lib/clipboard/file.rb', line 13

def paste(_ = nil)
  File.read(FILE) rescue ''
end