chars 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemspec +0 -0
- data/.yardopts +1 -1
- data/ChangeLog.md +9 -0
- data/README.md +4 -0
- data/Rakefile +3 -2
- data/chars.gemspec +124 -7
- data/gemspec.yml +5 -3
- data/lib/chars/char_set.rb +157 -38
- data/lib/chars/chars.rb +24 -20
- data/lib/chars/extensions/integer.rb +17 -17
- data/lib/chars/version.rb +1 -1
- data/spec/char_set_spec.rb +63 -89
- data/spec/chars_spec.rb +14 -73
- data/spec/{integer_spec.rb → extensions/integer_spec.rb} +1 -2
- data/spec/{string_spec.rb → extensions/string_spec.rb} +1 -2
- data/spec/spec_helper.rb +1 -0
- metadata +18 -38
data/spec/chars_spec.rb
CHANGED
@@ -1,115 +1,56 @@
|
|
1
|
-
require 'chars/chars'
|
2
|
-
|
3
1
|
require 'spec_helper'
|
2
|
+
require 'chars/chars'
|
4
3
|
|
5
4
|
describe Chars do
|
6
|
-
before(:all) do
|
7
|
-
@numeric_string = Chars.numeric.random_string(10)
|
8
|
-
@octal_string = Chars.octal.random_string(10)
|
9
|
-
@uppercase_hex_string = Chars.uppercase_hexadecimal.random_string(10)
|
10
|
-
@lowercase_hex_string = Chars.lowercase_hexadecimal.random_string(10)
|
11
|
-
@hex_string = Chars.hexadecimal.random_string(10)
|
12
|
-
@uppercase_alpha_string = Chars.uppercase_alpha.random_string(10)
|
13
|
-
@lowercase_alpha_string = Chars.lowercase_alpha.random_string(10)
|
14
|
-
@alpha_string = Chars.alpha.random_string(10)
|
15
|
-
@alpha_numeric_string = Chars.alpha_numeric.random_string(10)
|
16
|
-
@space_string = Chars.space.random_string(10)
|
17
|
-
@punctuation_string = Chars.punctuation.random_string(10)
|
18
|
-
@symbols_string = Chars.symbols.random_string(10)
|
19
|
-
@control_string = Chars.control.random_string(10)
|
20
|
-
@signed_ascii_string = Chars.signed_ascii.random_string(10)
|
21
|
-
@ascii_string = Chars.ascii.random_string(10)
|
22
|
-
@visible_string = Chars.visible.random_string(10)
|
23
|
-
end
|
24
|
-
|
25
5
|
it "should provide a numeric CharSet" do
|
26
|
-
|
27
|
-
@numeric_string.each_byte do |b|
|
28
|
-
Chars::NUMERIC.include?(b).should == true
|
29
|
-
end
|
6
|
+
Chars::NUMERIC =~ '0123456789'
|
30
7
|
end
|
31
8
|
|
32
9
|
it "should provide an octal CharSet" do
|
33
|
-
|
34
|
-
@octal_string.each_byte do |b|
|
35
|
-
Chars::OCTAL.include?(b).should == true
|
36
|
-
end
|
10
|
+
Chars::OCTAL =~ "01234567"
|
37
11
|
end
|
38
12
|
|
39
13
|
it "should provide an upper-case hexadecimal CharSet" do
|
40
|
-
|
41
|
-
@uppercase_hex_string.each_byte do |b|
|
42
|
-
Chars::UPPERCASE_HEXADECIMAL.include?(b).should == true
|
43
|
-
end
|
14
|
+
Chars::UPPERCASE_HEXADECIMAL =~ "0123456789ABCDEF"
|
44
15
|
end
|
45
16
|
|
46
17
|
it "should provide a lower-case hexadecimal CharSet" do
|
47
|
-
|
48
|
-
@lowercase_hex_string.each_byte do |b|
|
49
|
-
Chars::LOWERCASE_HEXADECIMAL.include?(b).should == true
|
50
|
-
end
|
18
|
+
Chars::LOWERCASE_HEXADECIMAL =~ "0123456789abcdef"
|
51
19
|
end
|
52
20
|
|
53
21
|
it "should provide a hexadecimal CharSet" do
|
54
|
-
|
55
|
-
@hex_string.each_byte do |b|
|
56
|
-
Chars::HEXADECIMAL.include?(b).should == true
|
57
|
-
end
|
22
|
+
Chars::HEXADECIMAL =~ "0123456789ABCDEFabcdef"
|
58
23
|
end
|
59
24
|
|
60
25
|
it "should provide an upper-case alpha CharSet" do
|
61
|
-
|
62
|
-
@uppercase_alpha_string.each_byte do |b|
|
63
|
-
Chars::UPPERCASE_ALPHA.include?(b).should == true
|
64
|
-
end
|
26
|
+
Chars::UPPERCASE_ALPHA =~ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
65
27
|
end
|
66
28
|
|
67
29
|
it "should provide a lower-case alpha CharSet" do
|
68
|
-
|
69
|
-
@lowercase_alpha_string.each_byte do |b|
|
70
|
-
Chars::LOWERCASE_ALPHA.include?(b).should == true
|
71
|
-
end
|
30
|
+
Chars::LOWERCASE_ALPHA =~ "abcdefghijklmnopqrstuvwxyz"
|
72
31
|
end
|
73
32
|
|
74
33
|
it "should provide an alpha CharSet" do
|
75
|
-
|
76
|
-
@alpha_string.each_byte do |b|
|
77
|
-
Chars::ALPHA.include?(b).should == true
|
78
|
-
end
|
34
|
+
Chars::ALPHA =~ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
79
35
|
end
|
80
36
|
|
81
37
|
it "should provide an alpha-numeric CharSet" do
|
82
|
-
|
83
|
-
@alpha_numeric_string.each_byte do |b|
|
84
|
-
Chars::ALPHA_NUMERIC.include?(b).should == true
|
85
|
-
end
|
38
|
+
Chars::ALPHA_NUMERIC =~ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
86
39
|
end
|
87
40
|
|
88
41
|
it "should provide a visible CharSet" do
|
89
|
-
|
90
|
-
@visible_string.each_byte do |b|
|
91
|
-
Chars::VISIBLE.include?(b).should == true
|
92
|
-
end
|
42
|
+
Chars::VISIBLE =~ "!\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
|
93
43
|
end
|
94
44
|
|
95
45
|
it "should provide a space CharSet" do
|
96
|
-
|
97
|
-
@space_string.each_byte do |b|
|
98
|
-
Chars::SPACE.include?(b).should == true
|
99
|
-
end
|
46
|
+
Chars::SPACE =~ "\t\n\v\f\r "
|
100
47
|
end
|
101
48
|
|
102
49
|
it "should provide a punctuation CharSet" do
|
103
|
-
|
104
|
-
@punctuation_string.each_byte do |b|
|
105
|
-
Chars::PUNCTUATION.include?(b).should == true
|
106
|
-
end
|
50
|
+
Chars::PUNCTUATION =~ " !\"'(),-.:;?[]`{}~"
|
107
51
|
end
|
108
52
|
|
109
53
|
it "should provide a symbols CharSet" do
|
110
|
-
|
111
|
-
@symbols_string.each_byte do |b|
|
112
|
-
Chars::SYMBOLS.include?(b).should == true
|
113
|
-
end
|
54
|
+
Chars::SYMBOLS =~ " !\"\#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
|
114
55
|
end
|
115
56
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chars
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
version: 0.2.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.2.1
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Postmodern
|
@@ -14,56 +10,44 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
13
|
+
date: 2011-06-22 00:00:00 Z
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
|
-
name: ore
|
16
|
+
name: ore-tasks
|
22
17
|
prerelease: false
|
23
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
19
|
none: false
|
25
20
|
requirements:
|
26
21
|
- - ~>
|
27
22
|
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 0
|
30
|
-
- 2
|
31
|
-
- 0
|
32
|
-
version: 0.2.0
|
23
|
+
version: "0.4"
|
33
24
|
type: :development
|
34
25
|
version_requirements: *id001
|
35
26
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
27
|
+
name: rspec
|
37
28
|
prerelease: false
|
38
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
30
|
none: false
|
40
31
|
requirements:
|
41
32
|
- - ~>
|
42
33
|
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
- 0
|
45
|
-
- 1
|
46
|
-
- 2
|
47
|
-
version: 0.1.2
|
34
|
+
version: "2.4"
|
48
35
|
type: :development
|
49
36
|
version_requirements: *id002
|
50
37
|
- !ruby/object:Gem::Dependency
|
51
|
-
name:
|
38
|
+
name: yard
|
52
39
|
prerelease: false
|
53
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
41
|
none: false
|
55
42
|
requirements:
|
56
43
|
- - ~>
|
57
44
|
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
- 2
|
60
|
-
- 0
|
61
|
-
- 0
|
62
|
-
version: 2.0.0
|
45
|
+
version: 0.6.1
|
63
46
|
type: :development
|
64
47
|
version_requirements: *id003
|
65
48
|
description: Chars is a Ruby library for working with various character sets, recognizing text and generating random text from specific character sets.
|
66
|
-
email:
|
49
|
+
email:
|
50
|
+
- postmodern.mod3@gmail.com
|
67
51
|
executables: []
|
68
52
|
|
69
53
|
extensions: []
|
@@ -74,6 +58,7 @@ extra_rdoc_files:
|
|
74
58
|
- LICENSE.txt
|
75
59
|
files:
|
76
60
|
- .document
|
61
|
+
- .gemspec
|
77
62
|
- .rspec
|
78
63
|
- .yardopts
|
79
64
|
- ChangeLog.md
|
@@ -91,10 +76,9 @@ files:
|
|
91
76
|
- lib/chars/version.rb
|
92
77
|
- spec/char_set_spec.rb
|
93
78
|
- spec/chars_spec.rb
|
94
|
-
- spec/integer_spec.rb
|
79
|
+
- spec/extensions/integer_spec.rb
|
80
|
+
- spec/extensions/string_spec.rb
|
95
81
|
- spec/spec_helper.rb
|
96
|
-
- spec/string_spec.rb
|
97
|
-
has_rdoc: yard
|
98
82
|
homepage: http://github.com/postmodern/chars
|
99
83
|
licenses:
|
100
84
|
- MIT
|
@@ -108,26 +92,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
92
|
requirements:
|
109
93
|
- - ">="
|
110
94
|
- !ruby/object:Gem::Version
|
111
|
-
|
112
|
-
- 0
|
113
|
-
version: "0"
|
95
|
+
version: 1.8.7
|
114
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
97
|
none: false
|
116
98
|
requirements:
|
117
99
|
- - ">="
|
118
100
|
- !ruby/object:Gem::Version
|
119
|
-
segments:
|
120
|
-
- 0
|
121
101
|
version: "0"
|
122
102
|
requirements: []
|
123
103
|
|
124
104
|
rubyforge_project: chars
|
125
|
-
rubygems_version: 1.
|
105
|
+
rubygems_version: 1.8.5
|
126
106
|
signing_key:
|
127
107
|
specification_version: 3
|
128
108
|
summary: A Ruby library for working with various character sets
|
129
109
|
test_files:
|
130
|
-
- spec/integer_spec.rb
|
131
110
|
- spec/chars_spec.rb
|
132
111
|
- spec/char_set_spec.rb
|
133
|
-
- spec/
|
112
|
+
- spec/extensions/integer_spec.rb
|
113
|
+
- spec/extensions/string_spec.rb
|