gsm_encoder 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gsm_encoder.rb +2 -11
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc5e53ca18eacc9115c7395a5f6c833f22571d19
|
4
|
+
data.tar.gz: eab20ccf00096deef3577367472e87ae88dfa6c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afd5459dc5be3e784c6b691d1ab6e6600cc0f333965cd1ad87b068a28787b98c92abc75534078f60e79e37506c0d8d2cbe5afe940032115949733593e71ba814
|
7
|
+
data.tar.gz: 088b1bbe74116558fd69645a61f8a4bc8df9f7f501f893071f733165002c6774ef6f6a30502ed728b4b9e9a1b3604623577c4abec30080b70bf331b3fc443c9f
|
data/lib/gsm_encoder.rb
CHANGED
@@ -48,7 +48,7 @@ module GSMEncoder
|
|
48
48
|
0, 0, 0, 0, 0, 'ú', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
49
49
|
]
|
50
50
|
|
51
|
-
|
51
|
+
REGEX = /\A[ -_a-~#{Regexp.escape(CHAR_TABLE + EXT_CHAR_TABLE.select {|c| c != 0}.join)}]*\Z/
|
52
52
|
|
53
53
|
# Verifies that this charset can represent every character in the Ruby
|
54
54
|
# String.
|
@@ -56,16 +56,7 @@ module GSMEncoder
|
|
56
56
|
# @return True if the charset can represent every character in the Ruby
|
57
57
|
# String, otherwise false.
|
58
58
|
def can_encode?(str)
|
59
|
-
|
60
|
-
|
61
|
-
str.each_char do |c|
|
62
|
-
# simple range checks for most common characters (' '..'_') or ('a'..'~')
|
63
|
-
b = c.getbyte(0)
|
64
|
-
unless b >= 0x20 && b <= 0x5F || b >= 0x61 && b <= 0x7E || CHARS.include?(c)
|
65
|
-
return false
|
66
|
-
end
|
67
|
-
end
|
68
|
-
true
|
59
|
+
!str || !!(REGEX =~ str)
|
69
60
|
end
|
70
61
|
|
71
62
|
def encode(str, replace_char=nil)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gsm_encoder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yury Korolev
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-03-18 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: GSMEncoder encodes and decodes Ruby Strings to and from the SMS default
|
15
15
|
alphabet. It also supports the default extension table. The default alphabet and
|
@@ -21,9 +21,9 @@ executables: []
|
|
21
21
|
extensions: []
|
22
22
|
extra_rdoc_files: []
|
23
23
|
files:
|
24
|
-
- lib/gsm_encoder.rb
|
25
24
|
- README.md
|
26
|
-
|
25
|
+
- lib/gsm_encoder.rb
|
26
|
+
homepage: http://github.com/yury/gsm_encoder
|
27
27
|
licenses: []
|
28
28
|
metadata: {}
|
29
29
|
post_install_message:
|
@@ -32,17 +32,17 @@ require_paths:
|
|
32
32
|
- lib
|
33
33
|
required_ruby_version: !ruby/object:Gem::Requirement
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ">="
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: '0'
|
38
38
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 1.3.6
|
43
43
|
requirements: []
|
44
44
|
rubyforge_project:
|
45
|
-
rubygems_version: 2.
|
45
|
+
rubygems_version: 2.2.0
|
46
46
|
signing_key:
|
47
47
|
specification_version: 4
|
48
48
|
summary: ruby GSM 03.38 encoder/decoder
|