ruco 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/ruco/text_area.rb +5 -0
- data/ruco.gemspec +2 -2
- data/spec/ruco/text_area_spec.rb +21 -0
- data/spec/spec_helper.rb +4 -0
- metadata +9 -9
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.10
|
data/lib/ruco/text_area.rb
CHANGED
@@ -14,6 +14,10 @@ module Ruco
|
|
14
14
|
attr_reader :lines, :selection, :column, :line
|
15
15
|
|
16
16
|
def initialize(content, options)
|
17
|
+
if content.respond_to?(:encoding) and content.encoding.to_s.include?('ASCII')
|
18
|
+
content = content.force_encoding('UTF-8')
|
19
|
+
end
|
20
|
+
|
17
21
|
@lines = content.naive_split("\n")
|
18
22
|
@options = options.dup
|
19
23
|
@column = 0
|
@@ -89,6 +93,7 @@ module Ruco
|
|
89
93
|
end
|
90
94
|
|
91
95
|
def insert(text)
|
96
|
+
text = text.force_encoding('UTF-8')
|
92
97
|
if @selection
|
93
98
|
if SURROUNDING_CHARS[text]
|
94
99
|
return surround_selection_with(text)
|
data/ruco.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ruco"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2012-01-08"
|
13
13
|
s.email = "michael@grosser.it"
|
14
14
|
s.executables = ["ruco"]
|
15
15
|
s.files = [
|
data/spec/ruco/text_area_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require File.expand_path('spec/spec_helper')
|
2
3
|
|
3
4
|
describe Ruco::TextArea do
|
@@ -159,4 +160,24 @@ describe Ruco::TextArea do
|
|
159
160
|
end
|
160
161
|
end
|
161
162
|
end
|
163
|
+
|
164
|
+
if ''.respond_to?(:encoding)
|
165
|
+
describe "encoding" do
|
166
|
+
def build(encoding)
|
167
|
+
Ruco::TextArea.new("asd".force_encoding(encoding), :lines => 3, :columns => 10)
|
168
|
+
end
|
169
|
+
|
170
|
+
it "upgrades ascii-8 to utf8" do
|
171
|
+
build('ASCII-8BIT').lines.first.encoding.to_s.should == 'UTF-8'
|
172
|
+
end
|
173
|
+
|
174
|
+
it "upgrades ascii-7 to utf8" do
|
175
|
+
build('US-ASCII').lines.first.encoding.to_s.should == 'UTF-8'
|
176
|
+
end
|
177
|
+
|
178
|
+
it "does not convert weird encodings to utf-8" do
|
179
|
+
build('eucJP').lines.first.encoding.to_s.should == 'EUC-JP'
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
162
183
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: clipboard
|
16
|
-
requirement: &
|
16
|
+
requirement: &73318490 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.8
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *73318490
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: textpow1x
|
27
|
-
requirement: &
|
27
|
+
requirement: &73317330 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.2.4
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *73317330
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: language_sniffer
|
38
|
-
requirement: &
|
38
|
+
requirement: &73315900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *73315900
|
47
47
|
description:
|
48
48
|
email: michael@grosser.it
|
49
49
|
executables:
|
@@ -129,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
129
|
version: '0'
|
130
130
|
segments:
|
131
131
|
- 0
|
132
|
-
hash:
|
132
|
+
hash: 956041619
|
133
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
134
|
none: false
|
135
135
|
requirements:
|