clipboard 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/clipboard.gemspec +1 -1
- data/doc/Clipboard.html +30 -28
- data/doc/README_rdoc.html +1 -1
- data/doc/created.rid +2 -2
- data/doc/index.html +3 -3
- data/doc/lib/clipboard_rb.html +2 -2
- data/lib/clipboard.rb +19 -14
- metadata +7 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.1
|
data/clipboard.gemspec
CHANGED
data/doc/Clipboard.html
CHANGED
@@ -151,7 +151,7 @@
|
|
151
151
|
<dd class="description"></dd>
|
152
152
|
|
153
153
|
|
154
|
-
<dt><a name="
|
154
|
+
<dt><a name="CLIPBOARDS">CLIPBOARDS</a></dt>
|
155
155
|
|
156
156
|
<dd class="description"></dd>
|
157
157
|
|
@@ -199,10 +199,10 @@
|
|
199
199
|
<div class="method-source-code"
|
200
200
|
id="clear-source">
|
201
201
|
<pre>
|
202
|
-
<span class="ruby-comment cmt"># File lib/clipboard.rb, line
|
203
|
-
|
204
|
-
|
205
|
-
|
202
|
+
<span class="ruby-comment cmt"># File lib/clipboard.rb, line 82</span>
|
203
|
+
82: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">clear</span>
|
204
|
+
83: <span class="ruby-identifier">copy</span> <span class="ruby-value str">''</span>
|
205
|
+
84: <span class="ruby-keyword kw">end</span></pre>
|
206
206
|
</div>
|
207
207
|
|
208
208
|
</div>
|
@@ -263,20 +263,22 @@
|
|
263
263
|
|
264
264
|
<div class="method-description">
|
265
265
|
|
266
|
-
|
266
|
+
<p>
|
267
|
+
copy for all platforms
|
268
|
+
</p>
|
267
269
|
|
268
270
|
|
269
271
|
|
270
272
|
<div class="method-source-code"
|
271
273
|
id="copy-source">
|
272
274
|
<pre>
|
273
|
-
<span class="ruby-comment cmt"># File lib/clipboard.rb, line
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
275
|
+
<span class="ruby-comment cmt"># File lib/clipboard.rb, line 88</span>
|
276
|
+
88: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">copy</span>(<span class="ruby-identifier">data</span>)
|
277
|
+
89: <span class="ruby-constant">WriteCommands</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">cmd</span><span class="ruby-operator">|</span>
|
278
|
+
90: <span class="ruby-constant">IO</span>.<span class="ruby-identifier">popen</span>( <span class="ruby-identifier">cmd</span>, <span class="ruby-value str">'w'</span> ){ <span class="ruby-operator">|</span><span class="ruby-identifier">input</span><span class="ruby-operator">|</span> <span class="ruby-identifier">input</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">data</span> }
|
279
|
+
91: }
|
280
|
+
92: <span class="ruby-identifier">paste</span>
|
281
|
+
93: <span class="ruby-keyword kw">end</span></pre>
|
280
282
|
</div>
|
281
283
|
|
282
284
|
</div>
|
@@ -307,15 +309,15 @@
|
|
307
309
|
<div class="method-source-code"
|
308
310
|
id="paste-source">
|
309
311
|
<pre>
|
310
|
-
<span class="ruby-comment cmt"># File lib/clipboard.rb, line
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
312
|
+
<span class="ruby-comment cmt"># File lib/clipboard.rb, line 73</span>
|
313
|
+
73: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">paste</span>(<span class="ruby-identifier">which</span> = <span class="ruby-keyword kw">nil</span>)
|
314
|
+
74: <span class="ruby-identifier">selection_string</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Clipboards</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">which</span>.<span class="ruby-identifier">to_s</span>)
|
315
|
+
75: <span class="ruby-node">" -selection #{which}"</span>
|
316
|
+
76: <span class="ruby-keyword kw">else</span>
|
317
|
+
77: <span class="ruby-value str">''</span>
|
318
|
+
78: <span class="ruby-keyword kw">end</span>
|
319
|
+
79: <span class="ruby-node">%[#{ ReadCommand + selection_string }]</span>
|
320
|
+
80: <span class="ruby-keyword kw">end</span></pre>
|
319
321
|
</div>
|
320
322
|
|
321
323
|
</div>
|
@@ -352,16 +354,16 @@ does not work on 1.9, has probably something to do with utf8 strings ?
|
|
352
354
|
<pre>
|
353
355
|
<span class="ruby-comment cmt"># File lib/clipboard.rb, line 28</span>
|
354
356
|
28: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">paste</span>(<span class="ruby-identifier">_</span>=<span class="ruby-keyword kw">nil</span>)
|
355
|
-
29:
|
357
|
+
29: <span class="ruby-identifier">data</span> = <span class="ruby-value str">""</span>
|
356
358
|
30: <span class="ruby-keyword kw">if</span> <span class="ruby-value">0</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@open</span>[ <span class="ruby-value">0</span> ]
|
357
|
-
31:
|
359
|
+
31: <span class="ruby-identifier">hclip</span> = <span class="ruby-ivar">@get</span>[ <span class="ruby-constant">CF_TEXT</span> ]
|
358
360
|
32: <span class="ruby-keyword kw">if</span> <span class="ruby-value">0</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">hclip</span>
|
359
|
-
33:
|
361
|
+
33: <span class="ruby-keyword kw">if</span> <span class="ruby-value">0</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">data</span> = <span class="ruby-ivar">@lock</span>[ <span class="ruby-identifier">hclip</span> ]
|
360
362
|
34: <span class="ruby-ivar">@unlock</span>[ <span class="ruby-identifier">hclip</span> ]
|
361
|
-
35:
|
362
|
-
36:
|
363
|
+
35: <span class="ruby-keyword kw">end</span>
|
364
|
+
36: <span class="ruby-keyword kw">end</span>
|
363
365
|
37: <span class="ruby-ivar">@close</span>[]
|
364
|
-
38:
|
366
|
+
38: <span class="ruby-keyword kw">end</span>
|
365
367
|
39: <span class="ruby-identifier">data</span> <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>
|
366
368
|
40: <span class="ruby-keyword kw">end</span></pre>
|
367
369
|
</div>
|
data/doc/README_rdoc.html
CHANGED
data/doc/created.rid
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
Sun, 03 Oct 2010
|
1
|
+
Sun, 03 Oct 2010 16:24:04 +0200
|
2
2
|
README.rdoc Sun, 03 Oct 2010 06:03:31 +0200
|
3
|
-
lib/clipboard.rb Sun, 03 Oct 2010
|
3
|
+
lib/clipboard.rb Sun, 03 Oct 2010 16:23:51 +0200
|
data/doc/index.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<head>
|
7
7
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
8
8
|
|
9
|
-
<title>clipboard 0.
|
9
|
+
<title>clipboard 0.8.0
|
10
10
|
</title>
|
11
11
|
|
12
12
|
<link type="text/css" media="screen" href="rdoc.css" rel="stylesheet" />
|
@@ -20,11 +20,11 @@
|
|
20
20
|
<body class="indexpage">
|
21
21
|
|
22
22
|
|
23
|
-
<h1>clipboard 0.
|
23
|
+
<h1>clipboard 0.8.0
|
24
24
|
</h1>
|
25
25
|
|
26
26
|
|
27
|
-
<p>This is the API documentation for 'clipboard 0.
|
27
|
+
<p>This is the API documentation for 'clipboard 0.8.0
|
28
28
|
'.</p>
|
29
29
|
|
30
30
|
|
data/doc/lib/clipboard_rb.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<head>
|
7
7
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
8
8
|
|
9
|
-
<title>File: clipboard.rb [clipboard 0.
|
9
|
+
<title>File: clipboard.rb [clipboard 0.8.0
|
10
10
|
]</title>
|
11
11
|
|
12
12
|
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet" />
|
@@ -25,7 +25,7 @@
|
|
25
25
|
<div id="metadata">
|
26
26
|
<dl>
|
27
27
|
<dt class="modified-date">Last Modified</dt>
|
28
|
-
<dd class="modified-date">2010-10-03
|
28
|
+
<dd class="modified-date">2010-10-03 16:23:51 +0200</dd>
|
29
29
|
|
30
30
|
|
31
31
|
<dt class="requires">Requires</dt>
|
data/lib/clipboard.rb
CHANGED
@@ -26,16 +26,16 @@ module Clipboard
|
|
26
26
|
# inspired by segment7.net and http://www.codeproject.com/KB/clipboard/archerclipboard1.aspx
|
27
27
|
# does not work on 1.9, has probably something to do with utf8 strings ?
|
28
28
|
def self.paste(_=nil)
|
29
|
-
|
29
|
+
data = ""
|
30
30
|
if 0 != @open[ 0 ]
|
31
|
-
|
31
|
+
hclip = @get[ CF_TEXT ]
|
32
32
|
if 0 != hclip
|
33
|
-
|
33
|
+
if 0 != data = @lock[ hclip ]
|
34
34
|
@unlock[ hclip ]
|
35
|
+
end
|
35
36
|
end
|
36
|
-
end
|
37
37
|
@close[]
|
38
|
-
|
38
|
+
end
|
39
39
|
data || ""
|
40
40
|
end
|
41
41
|
|
@@ -52,18 +52,22 @@ module Clipboard
|
|
52
52
|
WriteCommands = ['pbcopy']
|
53
53
|
ReadCommand = 'pbpaste'
|
54
54
|
else # linuX
|
55
|
-
|
56
|
-
WriteCommands =
|
55
|
+
CLIPBOARDS = %w[clipboard primary secondary]
|
56
|
+
WriteCommands = CLIPBOARDS.map{|cb| 'xclip -selection ' + cb }
|
57
57
|
ReadCommand = 'xclip -o'
|
58
58
|
|
59
59
|
# catch dependency errors
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
60
|
+
begin
|
61
|
+
Open3.popen3( "xclip -version" ){ |_, _, error|
|
62
|
+
unless error.read =~ /^xclip version/
|
63
|
+
raise LoadError
|
64
|
+
end
|
65
|
+
}
|
66
|
+
rescue Exception
|
67
|
+
raise LoadError, "clipboard -\n" +
|
68
|
+
"Could not find required prgram xclip\n" +
|
69
|
+
"You can install it (on debian/ubuntu) with sudo apt-get install xclip"
|
70
|
+
end
|
67
71
|
end
|
68
72
|
|
69
73
|
def self.paste(which = nil)
|
@@ -80,6 +84,7 @@ module Clipboard
|
|
80
84
|
end
|
81
85
|
end
|
82
86
|
|
87
|
+
# copy for all platforms
|
83
88
|
def self.copy(data)
|
84
89
|
WriteCommands.each{ |cmd|
|
85
90
|
IO.popen( cmd, 'w' ){ |input| input << data }
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clipboard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 61
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 8
|
8
|
-
-
|
9
|
-
version: 0.8.
|
9
|
+
- 1
|
10
|
+
version: 0.8.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Jan Lelis
|
@@ -25,6 +26,7 @@ dependencies:
|
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
27
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
28
30
|
segments:
|
29
31
|
- 0
|
30
32
|
version: "0"
|
@@ -38,6 +40,7 @@ dependencies:
|
|
38
40
|
requirements:
|
39
41
|
- - ">="
|
40
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 11
|
41
44
|
segments:
|
42
45
|
- 4
|
43
46
|
version: "4"
|
@@ -107,6 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
110
|
requirements:
|
108
111
|
- - ">="
|
109
112
|
- !ruby/object:Gem::Version
|
113
|
+
hash: 3
|
110
114
|
segments:
|
111
115
|
- 0
|
112
116
|
version: "0"
|
@@ -115,6 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
119
|
requirements:
|
116
120
|
- - ">="
|
117
121
|
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
118
123
|
segments:
|
119
124
|
- 0
|
120
125
|
version: "0"
|