ultra7 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/ultra7/mime.rb +7 -4
- data/lib/ultra7/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f62703e25a0ab003dc3357a058cd477a2e06f641
|
4
|
+
data.tar.gz: 3f23a8005cd49ed42b90e6332b6eaee95840b733
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bb714b90e0515d702ff2323d4d7f36512fe8b31f85b5d52b61f569958476d41354909d5cb637f2481a2dbbf4ffd70432c2e760c63ceb2ed6eadfdd9ba035fd2
|
7
|
+
data.tar.gz: 791973fca61789c8ad943c828e9174228a4c463fa2e6b4caee4d87e60808e8667fd595566017fe42c9530b40276601b76337e673be6a57fe3616b98511710f9b
|
data/README.md
CHANGED
@@ -33,12 +33,12 @@ A UTF-7 MIME header decoder, plain and simple.
|
|
33
33
|
puts Ultra7::MIME.decode_utf7('1 +- 1 = 2')
|
34
34
|
=> "1 + 1 = 2"
|
35
35
|
|
36
|
-
#
|
36
|
+
# Decode a UTF-7 encoded string, returning string with default encoding
|
37
37
|
puts Ultra7::MIME.decode_utf7('Hello, +ZeVnLIqe-')
|
38
38
|
=> "Hello, 日本語"
|
39
|
-
|
40
|
-
#
|
41
|
-
#
|
39
|
+
|
40
|
+
# Decode a MIME encoded word, returning the decoded value
|
41
|
+
# as a string with explicit UTF-8 encoding
|
42
42
|
subject = '=?unicode-1-1-utf-7?Q?+vDCy7A- +wMHQ3A- +xUy5vA-(+wuTTKA-)?='
|
43
43
|
Ultra7::MIME.decode_utf7(subject, encoding: 'UTF-8')
|
44
44
|
=> "배달 상태 알림(실패)"
|
data/lib/ultra7/mime.rb
CHANGED
@@ -14,11 +14,14 @@ module Ultra7
|
|
14
14
|
# hash, then the resulting string will use the default
|
15
15
|
# `Encoding.default_external` encoding.
|
16
16
|
#
|
17
|
-
# @param [String] UTF-7 encoded
|
17
|
+
# @param [String] text UTF-7 string or MIME encoded word
|
18
18
|
# @param [Hash] options
|
19
|
-
# @
|
20
|
-
# @
|
21
|
-
|
19
|
+
# @option options [String] :encoding the encoding for the decoded value
|
20
|
+
# @return [String] decoded value, using either
|
21
|
+
# `Encoding.default_external` or the given `:encoding`
|
22
|
+
# @raise [ArgumentError] if the encoding passed in is not UTF-7,
|
23
|
+
# or if the encoding for the decoded value is not valid
|
24
|
+
def self.decode_utf7(text, options={encoding: nil})
|
22
25
|
# only deal with UTF-7 encoding
|
23
26
|
text.scan(/=\?(.*)\?[q]\?/i).each {
|
24
27
|
e = $1
|
data/lib/ultra7/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ultra7
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke M. Fujita
|
@@ -17,7 +17,7 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- .yardopts
|
20
|
+
- ".yardopts"
|
21
21
|
- CHANGELOG
|
22
22
|
- LICENSE
|
23
23
|
- README.md
|
@@ -34,18 +34,19 @@ require_paths:
|
|
34
34
|
- lib
|
35
35
|
required_ruby_version: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '1.9'
|
40
40
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
|
-
- -
|
42
|
+
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: '0'
|
45
45
|
requirements: []
|
46
46
|
rubyforge_project:
|
47
|
-
rubygems_version: 2.
|
47
|
+
rubygems_version: 2.2.2
|
48
48
|
signing_key:
|
49
49
|
specification_version: 4
|
50
50
|
summary: A UTF-7 MIME header decoder, plain and simple.
|
51
51
|
test_files: []
|
52
|
+
has_rdoc:
|