Module: Clipboard::File

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

Constant Summary collapse

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

Instance Method Summary collapse

Methods included from Implementation

#clear

Instance Method Details

#copy(data) ⇒ Object



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

def copy(data, **)
  ::File.open(FILE, 'w', 0o0600) { |f| f.write(data) } rescue ''

  true
end

#paste(_ = nil) ⇒ Object



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

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