cyphrb 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 robrobbins
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,16 @@
1
+ = cyphrb
2
+
3
+ Simple fold type cypher for scrambling and descrambling text:
4
+ >> require 'cyphrb'
5
+ => true
6
+ >> cyphr = Cyphr.new
7
+ =>...
8
+ >> hello = cyphr.scram('hello world!')
9
+ => "74ool dlio3!"
10
+ >> cyphr.descram(hello)
11
+ => "hello world!"
12
+
13
+
14
+ == Copyright
15
+
16
+ Copyright (c) 2010 robrobbins. See LICENSE for details.
@@ -0,0 +1,53 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "cyphrb"
8
+ gem.summary = 'Simple fold type cypher to scramble and descramble text'
9
+ gem.description = 'Cyphr class has two methods, scram(str) and descram(str). Both use gsub! so your return will be the modified string'
10
+ gem.email = "mail@robrobbins.info"
11
+ gem.homepage = "http://github.com/robrobbins/cyphrb"
12
+ gem.authors = ["robrobbins"]
13
+ gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
+ end
20
+
21
+ require 'rake/testtask'
22
+ Rake::TestTask.new(:test) do |test|
23
+ test.libs << 'lib' << 'test'
24
+ test.pattern = 'test/**/test_*.rb'
25
+ test.verbose = true
26
+ end
27
+
28
+ begin
29
+ require 'rcov/rcovtask'
30
+ Rcov::RcovTask.new do |test|
31
+ test.libs << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+ rescue LoadError
36
+ task :rcov do
37
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
38
+ end
39
+ end
40
+
41
+ task :test => :check_dependencies
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "cyphrb #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.1
@@ -0,0 +1,38 @@
1
+ #should use a module?
2
+ class Cyphr
3
+
4
+ def initialize
5
+ @cyph = {'a'=>'0', 'b'=>'1', 'c'=>'2', 'd'=>'3', 'e'=>'4', 'f'=>'5',
6
+ 'g'=>'6', 'h'=>'7', 'i'=>'8', 'j'=>'9', 'k'=>'p', 'l'=>'o',
7
+ 'm'=>'n', 'n'=>'m', 'o'=>'l', 'p'=>'k', 'q'=>'j', 'r'=>'i',
8
+ 's'=>'h', 't'=>'g', 'u'=>'f', 'v'=>'e', 'w'=>'d', 'x'=>'c',
9
+ 'y'=>'b', 'z'=>'a', '0'=>'q', '1'=>'r', '2'=>'s', '3'=>'t',
10
+ '4'=>'u', '5'=>'v', '6'=>'w', '7'=>'x', '8'=>'y', '9'=>'z',
11
+ 'A'=>'Z', 'B'=>'Y', 'C'=>'X', 'D'=>'W', 'E'=>'V', 'F'=>'U',
12
+ 'G'=>'T', 'H'=>'S', 'I'=>'R', 'J'=>'Q', 'K'=>'P', 'L'=>'O',
13
+ 'M'=>'N', 'N'=>'M', 'O'=>'L', 'P'=>'K', 'Q'=>'J', 'R'=>'I',
14
+ 'S'=>'H', 'T'=>'G', 'U'=>'F', 'V'=>'E', 'W'=>'D', 'X'=>'C',
15
+ 'Y'=>'B', 'Z'=>'A'}
16
+
17
+ @dcyph = {'0'=>'a', '1'=>'b', '2'=>'c', '3'=>'d','4'=>'e','5'=>'f',
18
+ '6'=>'g', '7'=>'h', '8'=>'i', '9'=>'j', 'p'=>'k', 'o'=>'l',
19
+ 'n'=>'m', 'm'=>'n', 'l'=>'o', 'k'=>'p', 'j'=>'q', 'i'=>'r',
20
+ 'h'=>'s', 'g'=>'t', 'f'=>'u', 'e'=>'v', 'd'=>'w', 'c'=>'x',
21
+ 'b'=>'y', 'a'=>'z', 'q'=>'0', 'r'=>'1', 's'=>'2', 't'=>'3',
22
+ 'u'=>'4', 'v'=>'5', 'w'=>'6', 'x'=>'7', 'y'=>'8', 'z'=>'9',
23
+ 'Z'=>'A', 'Y'=>'B', 'X'=>'C', 'W'=>'D', 'V'=>'E', 'U'=>'F',
24
+ 'T'=>'G', 'S'=>'H', 'R'=>'I', 'Q'=>'J', 'P'=>'K', 'O'=>'L',
25
+ 'N'=>'M', 'M'=>'N', 'L'=>'O', 'K'=>'P', 'J'=>'Q', 'I'=>'R',
26
+ 'H'=>'S', 'G'=>'T', 'F'=>'U', 'E'=>'V', 'D'=>'W', 'C'=>'X',
27
+ 'B'=>'Y', 'A'=>'Z'}
28
+ end
29
+
30
+ def scram(str)
31
+ str.gsub!(/[a-zA-Z0-9]/) { |match| @cyph[match] }
32
+ end
33
+
34
+ def descram(str)
35
+ str.gsub!(/[a-zA-Z0-9]/) { |match| @dcyph[match] }
36
+ end
37
+
38
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'cyphrb'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestCyphrb < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cyphrb
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 1
9
+ version: 1.0.1
10
+ platform: ruby
11
+ authors:
12
+ - robrobbins
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-04-25 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: thoughtbot-shoulda
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :development
31
+ version_requirements: *id001
32
+ description: Cyphr class has two methods, scram(str) and descram(str). Both use gsub! so your return will be the modified string
33
+ email: mail@robrobbins.info
34
+ executables: []
35
+
36
+ extensions: []
37
+
38
+ extra_rdoc_files:
39
+ - LICENSE
40
+ - README.rdoc
41
+ files:
42
+ - .document
43
+ - .gitignore
44
+ - LICENSE
45
+ - README.rdoc
46
+ - Rakefile
47
+ - VERSION
48
+ - lib/cyphrb.rb
49
+ - test/helper.rb
50
+ - test/test_cyphrb.rb
51
+ has_rdoc: true
52
+ homepage: http://github.com/robrobbins/cyphrb
53
+ licenses: []
54
+
55
+ post_install_message:
56
+ rdoc_options:
57
+ - --charset=UTF-8
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ requirements: []
75
+
76
+ rubyforge_project:
77
+ rubygems_version: 1.3.6
78
+ signing_key:
79
+ specification_version: 3
80
+ summary: Simple fold type cypher to scramble and descramble text
81
+ test_files:
82
+ - test/helper.rb
83
+ - test/test_cyphrb.rb