janlelis/clipboard

FrozenError on Windows

scivola opened this issue · 2 comments

The following script causes FrozenError on Windows at here.

gem "clipboard", "1.3.1"
require "clipboard"

Clipboard.copy "Foo"

The cause is simply adding # frozen_string_literal: true.

This will fix the problem.

diff --git a/lib/clipboard/windows.rb b/lib/clipboard/windows.rb
index 613468b..6b6e27b 100644
--- a/lib/clipboard/windows.rb
+++ b/lib/clipboard/windows.rb
@@ -42,7 +42,7 @@ module Clipboard
 
     # see http://www.codeproject.com/KB/clipboard/archerclipboard1.aspx
     def paste(_ = nil)
-      data = ""
+      data = +""
       if 0 != User32.open( 0 )
         hclip = User32.get( CF_UNICODETEXT )
         if hclip && 0 != hclip

Right! Thanks!

The fix is released!