charlock_holmes_heroku 0.6.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +3 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +30 -0
- data/MIT-LICENSE +20 -0
- data/README.md +111 -0
- data/Rakefile +29 -0
- data/benchmark/detection.rb +39 -0
- data/benchmark/test.txt +693 -0
- data/charlock_holmes.gemspec +25 -0
- data/ext/charlock_holmes/common.h +41 -0
- data/ext/charlock_holmes/converter.c +53 -0
- data/ext/charlock_holmes/encoding_detector.c +295 -0
- data/ext/charlock_holmes/ext.c +13 -0
- data/ext/charlock_holmes/extconf.rb +86 -0
- data/ext/charlock_holmes/src/icu4c-49_1_2-src.tgz +0 -0
- data/ext/charlock_holmes/src/icu4c-52_1-src.tgz +0 -0
- data/lib/charlock_holmes.rb +6 -0
- data/lib/charlock_holmes/encoding_detector.rb +33 -0
- data/lib/charlock_holmes/string.rb +34 -0
- data/lib/charlock_holmes/version.rb +3 -0
- data/spec/converter_spec.rb +29 -0
- data/spec/encoding_detector_spec.rb +122 -0
- data/spec/fixtures/AnsiGraph.psm1 +0 -0
- data/spec/fixtures/TwigExtensionsDate.es.yml +8 -0
- data/spec/fixtures/cl-messagepack.lisp +264 -0
- data/spec/fixtures/core.rkt +254 -0
- data/spec/fixtures/hello_world +0 -0
- data/spec/fixtures/laholator.py +131 -0
- data/spec/fixtures/repl2.cljs +109 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/string_method_spec.rb +52 -0
- metadata +133 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'charlock_holmes/string'
|
3
|
+
|
4
|
+
describe String do
|
5
|
+
test 'has a detect_encoding method' do
|
6
|
+
str = 'test'
|
7
|
+
str.respond_to? :detect_encoding
|
8
|
+
|
9
|
+
detected = str.detect_encoding
|
10
|
+
assert_equal 'ISO-8859-1', detected[:encoding]
|
11
|
+
end
|
12
|
+
|
13
|
+
test 'has a detect_encoding method that accepts an encoding hint' do
|
14
|
+
str = 'test'
|
15
|
+
str.respond_to? :detect_encoding
|
16
|
+
|
17
|
+
detected = str.detect_encoding 'UTF-8'
|
18
|
+
assert_equal 'ISO-8859-1', detected[:encoding]
|
19
|
+
end
|
20
|
+
|
21
|
+
test 'has a detect_encodings method' do
|
22
|
+
str = 'test'
|
23
|
+
str.respond_to? :detect_encodings
|
24
|
+
|
25
|
+
detected_list = str.detect_encodings
|
26
|
+
assert detected_list.is_a? Array
|
27
|
+
|
28
|
+
encoding_list = detected_list.map {|d| d[:encoding]}.sort
|
29
|
+
assert_equal ['ISO-8859-1', 'ISO-8859-2', 'UTF-8'], encoding_list
|
30
|
+
end
|
31
|
+
|
32
|
+
test 'has a detect_encodings method that accepts an encoding hint' do
|
33
|
+
str = 'test'
|
34
|
+
str.respond_to? :detect_encodings
|
35
|
+
|
36
|
+
detected_list = str.detect_encodings 'UTF-8'
|
37
|
+
assert detected_list.is_a? Array
|
38
|
+
|
39
|
+
encoding_list = detected_list.map {|d| d[:encoding]}.sort
|
40
|
+
assert_equal ['ISO-8859-1', 'ISO-8859-2', 'UTF-8'], encoding_list
|
41
|
+
end
|
42
|
+
|
43
|
+
if RUBY_VERSION =~ /1.9/
|
44
|
+
test 'has a detect_encoding! method' do
|
45
|
+
str = 'test'
|
46
|
+
str.respond_to? :detect_encoding!
|
47
|
+
|
48
|
+
str.detect_encoding!
|
49
|
+
assert_equal Encoding.find('ISO-8859-1'), str.encoding
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: charlock_holmes_heroku
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.6.13
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Lopez
|
8
|
+
- Vicent Martí
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-12-02 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake-compiler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.7.5
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.7.5
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rspec
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 2.0.0
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 2.0.0
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: chardet
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
description:
|
57
|
+
email: seniorlopez@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions:
|
60
|
+
- ext/charlock_holmes/extconf.rb
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- .gitignore
|
64
|
+
- .rspec
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- MIT-LICENSE
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- benchmark/detection.rb
|
71
|
+
- benchmark/test.txt
|
72
|
+
- charlock_holmes.gemspec
|
73
|
+
- ext/charlock_holmes/common.h
|
74
|
+
- ext/charlock_holmes/converter.c
|
75
|
+
- ext/charlock_holmes/encoding_detector.c
|
76
|
+
- ext/charlock_holmes/ext.c
|
77
|
+
- ext/charlock_holmes/extconf.rb
|
78
|
+
- ext/charlock_holmes/src/file-5.08.tar.gz
|
79
|
+
- ext/charlock_holmes/src/file-soft-check.patch
|
80
|
+
- ext/charlock_holmes/src/icu4c-49_1_2-src.tgz
|
81
|
+
- ext/charlock_holmes/src/icu4c-52_1-src.tgz
|
82
|
+
- lib/charlock_holmes.rb
|
83
|
+
- lib/charlock_holmes/encoding_detector.rb
|
84
|
+
- lib/charlock_holmes/string.rb
|
85
|
+
- lib/charlock_holmes/version.rb
|
86
|
+
- spec/converter_spec.rb
|
87
|
+
- spec/encoding_detector_spec.rb
|
88
|
+
- spec/fixtures/AnsiGraph.psm1
|
89
|
+
- spec/fixtures/TwigExtensionsDate.es.yml
|
90
|
+
- spec/fixtures/cl-messagepack.lisp
|
91
|
+
- spec/fixtures/core.rkt
|
92
|
+
- spec/fixtures/hello_world
|
93
|
+
- spec/fixtures/laholator.py
|
94
|
+
- spec/fixtures/repl2.cljs
|
95
|
+
- spec/spec_helper.rb
|
96
|
+
- spec/string_method_spec.rb
|
97
|
+
homepage: http://github.com/brianmario/charlock_holmes
|
98
|
+
licenses: []
|
99
|
+
metadata: {}
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options:
|
102
|
+
- --charset=UTF-8
|
103
|
+
require_paths:
|
104
|
+
- lib
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
requirements: []
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 2.1.11
|
118
|
+
signing_key:
|
119
|
+
specification_version: 4
|
120
|
+
summary: Character encoding detection, brought to you by ICU
|
121
|
+
test_files:
|
122
|
+
- spec/converter_spec.rb
|
123
|
+
- spec/encoding_detector_spec.rb
|
124
|
+
- spec/fixtures/AnsiGraph.psm1
|
125
|
+
- spec/fixtures/TwigExtensionsDate.es.yml
|
126
|
+
- spec/fixtures/cl-messagepack.lisp
|
127
|
+
- spec/fixtures/core.rkt
|
128
|
+
- spec/fixtures/hello_world
|
129
|
+
- spec/fixtures/laholator.py
|
130
|
+
- spec/fixtures/repl2.cljs
|
131
|
+
- spec/spec_helper.rb
|
132
|
+
- spec/string_method_spec.rb
|
133
|
+
has_rdoc:
|