tyop 0.0.1 → 0.0.2

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.
Files changed (5) hide show
  1. data/README.rdoc +7 -1
  2. data/VERSION +1 -1
  3. data/lib/tyop.rb +12 -8
  4. data/tyop.gemspec +1 -1
  5. metadata +3 -3
@@ -1,6 +1,12 @@
1
1
  = tyop
2
2
 
3
- Description goes here.
3
+ Intentionally adds typos to strings.
4
+
5
+ gem install tyop
6
+
7
+ require 'tyop'
8
+
9
+ "hello what's up".typolize => "hello wuat's hp"
4
10
 
5
11
  == Note on Patches/Pull Requests
6
12
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -1,16 +1,20 @@
1
1
  module Tyop
2
- def typolize
3
- original = self
2
+ LOWERCASE_LETTERS = ('a'..'z').to_a
3
+ UPPERCASE_LETTERS = ('A'..'Z').to_a
4
+ LETTERS = LOWERCASE_LETTERS + UPPERCASE_LETTERS
5
+
6
+ def typolize(count=1)
7
+ original = self.dup
4
8
 
5
9
  length = original.length
6
- a = rand(length)
7
- b = rand(length)
8
10
 
9
- first = original[a]
10
- second = original[b]
11
+ count.times do
12
+ a = rand(length)
11
13
 
12
- original[a] = second
13
- original[b] = first
14
+ l = LETTERS.length
15
+
16
+ original[a] = LETTERS[rand(l)]
17
+ end
14
18
 
15
19
  original
16
20
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{tyop}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Isaac Priestley"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tyop
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Isaac Priestley