rahoulb-rujitsu 0.1.0 → 0.1.1
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.
- data/CHANGELOG +7 -0
- data/README.rdoc +11 -17
- data/Rakefile +3 -3
- data/lib/rujitsu.rb +29 -3
- data/rujitsu.gemspec +5 -5
- metadata +6 -4
data/CHANGELOG
ADDED
data/README.rdoc
CHANGED
@@ -16,6 +16,12 @@ The Fixnum class has a couple of extensions allowing you to generate random stri
|
|
16
16
|
5.random_numbers
|
17
17
|
5.random_characters
|
18
18
|
|
19
|
+
You can also generate a variable length string.
|
20
|
+
|
21
|
+
(3..5).random_letters
|
22
|
+
|
23
|
+
This generates a string of random letters whose length is 3, 4 or 5 characters.
|
24
|
+
|
19
25
|
=== URL-friendly strings
|
20
26
|
|
21
27
|
The String class has an extension that strips out URL-unfriendly characters.
|
@@ -26,22 +32,10 @@ The String class has an extension that strips out URL-unfriendly characters.
|
|
26
32
|
|
27
33
|
Copyright (c) 2008 Brightbox Systems Ltd
|
28
34
|
|
29
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
30
|
-
|
31
|
-
in
|
32
|
-
|
33
|
-
|
34
|
-
furnished to do so, subject to the following conditions:
|
35
|
-
|
36
|
-
* The above copyright notice and this permission notice shall be included in
|
37
|
-
all copies or substantial portions of the Software.
|
38
|
-
|
39
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
40
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
41
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
42
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
43
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
44
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
45
|
-
THE SOFTWARE.
|
35
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
36
|
+
|
37
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
38
|
+
|
39
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
46
40
|
|
47
41
|
See http://www.brightbox.co.uk/ for contact details.
|
data/Rakefile
CHANGED
@@ -2,11 +2,11 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('rujitsu', '0.1.
|
5
|
+
Echoe.new('rujitsu', '0.1.1') do | config |
|
6
6
|
config.description = 'Various helper methods to smooth over Ruby development'
|
7
7
|
config.url = 'http://github.com/rahoub/rujitsu'
|
8
|
-
config.author = '
|
9
|
-
config.email = 'hello@
|
8
|
+
config.author = 'Brightbox Systems Ltd'
|
9
|
+
config.email = 'hello@brightbox.co.uk'
|
10
10
|
config.ignore_pattern = ['tmp/*', 'script/*']
|
11
11
|
config.development_dependencies = []
|
12
12
|
end
|
data/lib/rujitsu.rb
CHANGED
@@ -8,7 +8,7 @@ class Numeric
|
|
8
8
|
end
|
9
9
|
|
10
10
|
class Fixnum
|
11
|
-
|
11
|
+
# produce a string of N random letters
|
12
12
|
# 5.random_letters
|
13
13
|
def random_letters
|
14
14
|
generate_random_string_using LETTERS
|
@@ -40,11 +40,37 @@ class Fixnum
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
|
44
|
+
class Range
|
45
|
+
#�pull a random element out of this range
|
46
|
+
def to_random_i
|
47
|
+
self.to_a.sort_by { rand }.first
|
48
|
+
end
|
49
|
+
|
50
|
+
# create a string of random letters whose length is one of the values in your range
|
51
|
+
#� (3..4).random_letters #�=> returns a string or 3 or 4 random letters
|
52
|
+
def random_letters
|
53
|
+
self.to_random_i.random_letters
|
54
|
+
end
|
55
|
+
|
56
|
+
# create a string of random numbers whose length is one of the values in your range
|
57
|
+
#� (3..4).random_numbers #�=> returns a string or 3 or 4 random numbers
|
58
|
+
def random_numbers
|
59
|
+
self.to_random_i.random_numbers
|
60
|
+
end
|
61
|
+
|
62
|
+
# create a string of random characters whose length is one of the values in your range
|
63
|
+
#� (3..4).random_characters #�=> returns a string or 3 or 4 random characters
|
64
|
+
def random_characters
|
65
|
+
self.to_random_i.random_characters
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
|
43
71
|
class String
|
44
72
|
# Return a string that can be used as part of a url
|
45
73
|
def to_url
|
46
74
|
self.downcase.gsub(/[^\-0-9a-z ]/, '').split.join('-')
|
47
75
|
end
|
48
76
|
end
|
49
|
-
|
50
|
-
|
data/rujitsu.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rujitsu}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["
|
8
|
+
s.authors = ["Brightbox Systems Ltd"]
|
9
9
|
s.date = %q{2008-11-24}
|
10
10
|
s.description = %q{Various helper methods to smooth over Ruby development}
|
11
|
-
s.email = %q{hello@
|
12
|
-
s.extra_rdoc_files = ["lib/rujitsu.rb", "README.rdoc"]
|
13
|
-
s.files = ["lib/rujitsu.rb", "Rakefile", "README.rdoc", "
|
11
|
+
s.email = %q{hello@brightbox.co.uk}
|
12
|
+
s.extra_rdoc_files = ["CHANGELOG", "lib/rujitsu.rb", "README.rdoc"]
|
13
|
+
s.files = ["CHANGELOG", "lib/rujitsu.rb", "Manifest", "Rakefile", "README.rdoc", "rujitsu.gemspec"]
|
14
14
|
s.has_rdoc = true
|
15
15
|
s.homepage = %q{http://github.com/rahoub/rujitsu}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rujitsu", "--main", "README.rdoc"]
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rahoulb-rujitsu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Brightbox Systems Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
@@ -14,19 +14,21 @@ default_executable:
|
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: Various helper methods to smooth over Ruby development
|
17
|
-
email: hello@
|
17
|
+
email: hello@brightbox.co.uk
|
18
18
|
executables: []
|
19
19
|
|
20
20
|
extensions: []
|
21
21
|
|
22
22
|
extra_rdoc_files:
|
23
|
+
- CHANGELOG
|
23
24
|
- lib/rujitsu.rb
|
24
25
|
- README.rdoc
|
25
26
|
files:
|
27
|
+
- CHANGELOG
|
26
28
|
- lib/rujitsu.rb
|
29
|
+
- Manifest
|
27
30
|
- Rakefile
|
28
31
|
- README.rdoc
|
29
|
-
- Manifest
|
30
32
|
- rujitsu.gemspec
|
31
33
|
has_rdoc: true
|
32
34
|
homepage: http://github.com/rahoub/rujitsu
|