tedrahcu 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d48807123fd8e0cebb47f4d9c66b2bb20f4f7901
4
+ data.tar.gz: b232348b03b9dac3f8b3dbb131435a16c3f419be
5
+ SHA512:
6
+ metadata.gz: b5d880b778387930728bf1ea2cab5c6137b24363cf0bb1722bd2710aa1902641d1d2d7ea0b2cd68da6aa09ad9e94fee38e2527ed740ca5a3553bf90926dab25a
7
+ data.tar.gz: 8e7ba809b5c301c27dc66436a7a0754263c19e4fd63c6f737ebac049b1000024d1ce0c5e3320c33a4930c302afa8e57bfa60aec2def4b050e86ab90918d25b27
data/COPYING ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (c) Manfred Stienstra, Fingertips <manfred@fngtps.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # Tedrahcu
2
+
3
+ Tedrahcu is a Ruby wrapper for Uchardet.
4
+
5
+ ```sh
6
+ gem install tedrahcu
7
+ ```
8
+
9
+ ```ruby
10
+ require 'tedrahcu'
11
+ Tedrahcu.detect('hey') #=> 'ASCII'
12
+ ```
data/ext/extconf.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'mkmf'
2
+
3
+ dir_config('uchardet')
4
+ pkg_config('uchardet')
5
+ create_makefile('tedrahcu', 'tedrahcu')
@@ -0,0 +1,37 @@
1
+ #include <ruby.h>
2
+ #include <uchardet.h>
3
+
4
+ /*
5
+ * call-seq:
6
+ * detect(input)
7
+ *
8
+ * Return the charset that is detected in the input.
9
+ */
10
+ static VALUE tedrahcu_detect(VALUE self, VALUE input)
11
+ {
12
+ VALUE result;
13
+ uchardet_t detector;
14
+
15
+ // When the input is nil we return nil.
16
+ if (NIL_P(input)) return Qnil;
17
+
18
+ // In other cases we expect a string.
19
+ Check_Type(input, T_STRING);
20
+
21
+ detector = uchardet_new();
22
+ uchardet_handle_data(detector, StringValuePtr(input), RSTRING_LEN(input));
23
+ uchardet_data_end(detector);
24
+ result = rb_str_new2(uchardet_get_charset(detector));
25
+ uchardet_delete(detector);
26
+
27
+ return result;
28
+ }
29
+
30
+ void Init_tedrahcu()
31
+ {
32
+ VALUE mRingcurl;
33
+
34
+ mRingcurl = rb_define_module("Tedrahcu");
35
+
36
+ rb_define_module_function(mRingcurl, "detect", tedrahcu_detect, 1);
37
+ }
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tedrahcu
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Manfred Stienstra
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-05-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Uchardet tries to guess the encoding of a byte stream.
14
+ email:
15
+ - manfred@fngtps.com
16
+ executables: []
17
+ extensions:
18
+ - ext/extconf.rb
19
+ extra_rdoc_files:
20
+ - README.md
21
+ - COPYING
22
+ files:
23
+ - COPYING
24
+ - README.md
25
+ - ext/extconf.rb
26
+ - ext/tedrahcu/tedrahcu.c
27
+ homepage: http://github.com/Manfred/tedrahcu
28
+ licenses:
29
+ - MIT
30
+ metadata: {}
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubyforge_project:
47
+ rubygems_version: 2.5.2
48
+ signing_key:
49
+ specification_version: 4
50
+ summary: Ruby wrapper for uchardet
51
+ test_files: []