class Object

Public Instance Methods

copy(obj) click to toggle source
# File lib/copyrb.rb, line 4
def copy(obj)
  text = Base64.encode64(YAML.dump(obj)).gsub("\n", '') # getting rid of meaningless new lines
  IO.popen('pbcopy', 'r+') { |clipboard| clipboard.puts text }
end
paste() click to toggle source
# File lib/copyrb.rb, line 9
def paste
  text = IO.popen('pbpaste', 'r+') { |clipboard| clipboard.gets }
  YAML.load(Base64.decode64(text))
end