random_cases 0.1.0 → 0.2.0
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/README.md +31 -4
- data/lib/random_cases/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c192cee875514ffb4230e0e9a82da744dfd4ecc5
|
|
4
|
+
data.tar.gz: 879126bc6dabf092f8722b32c38896a5b1f19c8d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2da6070898c2f841b46c2bd68b553522c43b296ab27996ba40f5bc4a15d975e0ee6c31a643647d311b2b840f075022e43f6d9f9e45f74780756590b97b6b4750
|
|
7
|
+
data.tar.gz: a06fa343610c2b3b36fa89581423f02b4bc2e01b8c4fa49365dd01940c9c9e3e5d434dfa9cdf18b5254ae9c46142f6613fa2444c6dcd28121656c42ca7453677
|
data/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# RandomCases
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
|
3
|
+
Simple implementation of String method for randomizing characters in string or text
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
@@ -10,6 +8,8 @@ Add this line to your application's Gemfile:
|
|
|
10
8
|
|
|
11
9
|
```ruby
|
|
12
10
|
gem 'random_cases'
|
|
11
|
+
or
|
|
12
|
+
gem 'random_cases', '~> 0.2.0'
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
And then execute:
|
|
@@ -22,7 +22,34 @@ Or install it yourself as:
|
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
<h1>Ruby Random Cases</h1>
|
|
26
|
+
<br/>
|
|
27
|
+
<b>Regular:</b> Some simple text
|
|
28
|
+
|
|
29
|
+
<b>Converted:</b> soMe SimpLE tExT
|
|
30
|
+
<h2>Usage</h2>
|
|
31
|
+
Calling <b>.random_cases</b> string method on any string
|
|
32
|
+
"Some simple text".<b>random_cases</b>
|
|
33
|
+
|
|
34
|
+
class HomeController < ApplicationController<br/>
|
|
35
|
+
def index<br/>
|
|
36
|
+
@cool= "Some simple text"<br/>
|
|
37
|
+
@random = "Some simple text".<b>random_cases</b><br/>
|
|
38
|
+
end<br/>
|
|
39
|
+
end<br/>
|
|
40
|
+
<br/>
|
|
41
|
+
|
|
42
|
+
<h2>Method implementation</h2>
|
|
43
|
+
|
|
44
|
+
class String
|
|
45
|
+
|
|
46
|
+
def random_cases
|
|
47
|
+
|
|
48
|
+
self.gsub(/./){ |c| rand(2)>0 ? c : c.swapcase }
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
26
53
|
|
|
27
54
|
## Development
|
|
28
55
|
|
data/lib/random_cases/version.rb
CHANGED