booty 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/LICENSE +20 -0
- data/README.textile +19 -0
- data/Rakefile +67 -0
- data/VERSION +1 -0
- data/booty.gemspec +50 -0
- data/lib/booty.rb +97 -0
- data/spec/booty_spec.rb +10 -0
- data/spec/test_helper.rb +7 -0
- metadata +65 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Michael Deering
|
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.
|
data/README.textile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
h1. Booty: Pirate Speak Gem
|
2
|
+
|
3
|
+
h2. Install
|
4
|
+
<pre><code>gem sources -a http://gems.github.com
|
5
|
+
sudo gem install mdeering-booty</code></pre>
|
6
|
+
|
7
|
+
h2. Usage
|
8
|
+
<pre><code># We all require a little...
|
9
|
+
require 'booty'
|
10
|
+
msg = 'There was no question this was going to work as a singleton call. All puns intended!'
|
11
|
+
Booty.call(msg) # => "There was nay question this was going t' brig as a singleton call. All puns intended! surrender yer booty."</code></pre>
|
12
|
+
|
13
|
+
h2. Credits
|
14
|
+
|
15
|
+
I directly poached they Booty class from here "wcyd/devel/ircbot/rbot/lib":http://github.com/fapestniegd/wcyd
|
16
|
+
|
17
|
+
h2. Copyright
|
18
|
+
|
19
|
+
Copyright (c) 2009 "Michael Deering(Edmonton Ruby on Rails)":http://mdeering.com See MIT-LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "booty"
|
8
|
+
gem.summary = 'Bring \'er alongside. Tis be eh Ruby gem that converts english t\' pirate speak. Arrr.'
|
9
|
+
gem.description = 'Bring \'er alongside. Tis be eh Ruby gem that converts english t\' pirate speak. Arrr.'
|
10
|
+
gem.email = "mdeering@mdeering.com"
|
11
|
+
gem.homepage = "http://github.com/mdeering/booty"
|
12
|
+
gem.authors = ["Michael Deering"]
|
13
|
+
end
|
14
|
+
Jeweler::GemcutterTasks.new
|
15
|
+
rescue LoadError
|
16
|
+
puts "Take no prisoners! Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
17
|
+
end
|
18
|
+
|
19
|
+
desc 'Default: spec tests.'
|
20
|
+
task :default => :spec
|
21
|
+
|
22
|
+
begin
|
23
|
+
require 'rake/rdoctask'
|
24
|
+
require 'spec/rake/spectask'
|
25
|
+
Spec::Rake::SpecTask.new('spec') do |t|
|
26
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
27
|
+
t.spec_opts = ["-c"]
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "Run all examples with RCov"
|
31
|
+
Spec::Rake::SpecTask.new('examples_with_rcov') do |t|
|
32
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
33
|
+
t.rcov = true
|
34
|
+
t.rcov_opts = ['--exclude', '/opt,spec,Library']
|
35
|
+
end
|
36
|
+
rescue LoadError
|
37
|
+
puts "Take no prisoners! RSpec (or a dependency) not avalible: sudo gem install rspec"
|
38
|
+
end
|
39
|
+
|
40
|
+
begin
|
41
|
+
require 'rcov/rcovtask'
|
42
|
+
Rcov::RcovTask.new do |test|
|
43
|
+
test.libs << 'test'
|
44
|
+
test.pattern = 'test/**/*_test.rb'
|
45
|
+
test.verbose = true
|
46
|
+
end
|
47
|
+
rescue LoadError
|
48
|
+
task :rcov do
|
49
|
+
abort "Take no prisoners! RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
task :test => :check_dependencies
|
54
|
+
|
55
|
+
require 'rake/rdoctask'
|
56
|
+
Rake::RDocTask.new do |rdoc|
|
57
|
+
if File.exist?('VERSION')
|
58
|
+
version = File.read('VERSION')
|
59
|
+
else
|
60
|
+
version = ""
|
61
|
+
end
|
62
|
+
|
63
|
+
rdoc.rdoc_dir = 'rdoc'
|
64
|
+
rdoc.title = "booty #{version}"
|
65
|
+
rdoc.rdoc_files.include('README*')
|
66
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
67
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/booty.gemspec
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{booty}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Michael Deering"]
|
12
|
+
s.date = %q{2010-01-02}
|
13
|
+
s.description = %q{Bring 'er alongside. Tis be eh Ruby gem that converts english t' pirate speak. Arrr.}
|
14
|
+
s.email = %q{mdeering@mdeering.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.textile"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".gitignore",
|
21
|
+
"LICENSE",
|
22
|
+
"README.textile",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"booty.gemspec",
|
26
|
+
"lib/booty.rb",
|
27
|
+
"spec/booty_spec.rb",
|
28
|
+
"spec/test_helper.rb"
|
29
|
+
]
|
30
|
+
s.homepage = %q{http://github.com/mdeering/booty}
|
31
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
32
|
+
s.require_paths = ["lib"]
|
33
|
+
s.rubygems_version = %q{1.3.5}
|
34
|
+
s.summary = %q{Bring 'er alongside. Tis be eh Ruby gem that converts english t' pirate speak. Arrr.}
|
35
|
+
s.test_files = [
|
36
|
+
"spec/booty_spec.rb",
|
37
|
+
"spec/test_helper.rb"
|
38
|
+
]
|
39
|
+
|
40
|
+
if s.respond_to? :specification_version then
|
41
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
42
|
+
s.specification_version = 3
|
43
|
+
|
44
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
45
|
+
else
|
46
|
+
end
|
47
|
+
else
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
data/lib/booty.rb
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
class Booty
|
2
|
+
def self.call(input)
|
3
|
+
# Entire words only
|
4
|
+
map = {
|
5
|
+
'is' => 'be', 'big' => 'vast',
|
6
|
+
'friend' => 'matey', 'my' => 'me',
|
7
|
+
'say' => 'cry', 'small' => 'puny',
|
8
|
+
'cheat' => 'hornswaggle', 'everyone' => 'all hands',
|
9
|
+
'isn\'t' => 'be not', 'the' => 'tha',
|
10
|
+
'are' => 'be', 'to' => 't\'',
|
11
|
+
'of' => 'o\'', 'am' => 'be',
|
12
|
+
'you' => 'ya', 'yes' => 'aye',
|
13
|
+
'kill' => 'keelhaul', 'you' => 'ye',
|
14
|
+
'no' => 'nay', 'never' => 'nary',
|
15
|
+
'i\'m' => 'i be', 'you\'re' => 'you be',
|
16
|
+
'girl' => 'lass', 'woman' => 'wench',
|
17
|
+
'hello' => 'ahoy', 'beer' => 'grog',
|
18
|
+
'quickly' => 'smartly', 'do' => 'd\'',
|
19
|
+
'your' => 'yer', 'for' => 'fer',
|
20
|
+
'go' => 'sail', 'we' => 'our jolly crew',
|
21
|
+
'and' => 'n\'', 'good' => 'jolly good',
|
22
|
+
'yeah' => 'aye', 'that\'s' => 'that be',
|
23
|
+
'over' => 'o\'er', 'yah' => 'aye',
|
24
|
+
'hand' => 'hook', 'leg' => 'peg',
|
25
|
+
'eye' => 'eye-patch', 'flag' => 'jolly roger',
|
26
|
+
'dick' => 'plank', 'penis' => 'plank',
|
27
|
+
'fuck' => 'curse', 'shit' => 'shite',
|
28
|
+
'treasure' => 'booty', 'butt' => 'booty',
|
29
|
+
'really' => 'verily', 'leg' => 'peg',
|
30
|
+
'them' => '\'em', 'house' => 'shanty',
|
31
|
+
'home' => 'shanty', 'quickly' => 'smartly',
|
32
|
+
'posted' => 'tacked to the yardarm',
|
33
|
+
'address' => 'port o\' call', 'work' => 'brig',
|
34
|
+
'invalid' => 'sunk', 'sorry' => 'yarr',
|
35
|
+
'hey' => 'ahoy', 'boss' => 'admiral',
|
36
|
+
'manager' => 'admiral', 'captain' => 'Cap\'n',
|
37
|
+
'friends' => 'shipmates', 'people' => 'scallywags',
|
38
|
+
'earlier' => 'afore', 'women' => 'wenches',
|
39
|
+
'wife' => 'lady', 'girls' => 'lassies',
|
40
|
+
'interstate'=> 'high seas', 'highway' => 'ocean',
|
41
|
+
'car' => 'boat', 'truck' => 'schooner',
|
42
|
+
'suv' => 'ship', 'airplane' => 'flying machine',
|
43
|
+
'machine' => 'contraption', 'driving' => 'sailing',
|
44
|
+
}
|
45
|
+
|
46
|
+
# Pirate filler
|
47
|
+
fill = [
|
48
|
+
'avast', 'splice the mainbrace',
|
49
|
+
'shiver me timbers', 'ahoy',
|
50
|
+
'arrrrr', 'arrgh',
|
51
|
+
'yo ho ho', 'yarrr',
|
52
|
+
'eh', 'arrrghhh',
|
53
|
+
'where\'s me rum?', 'walk tha plank',
|
54
|
+
'arrr', 'ahoy matey',
|
55
|
+
'surrender yer booty', 'prepare to be boarded',
|
56
|
+
'hoist the mizzen', 'blow me down',
|
57
|
+
'swap the poop deck', 'ye landlubber',
|
58
|
+
'bring \'er alongside', 'hang \'im from the yardarm',
|
59
|
+
'blow the man down', 'let go and haul',
|
60
|
+
'heave to', 'take no prisoners',
|
61
|
+
'belay that', 'me bucko',
|
62
|
+
'lock \'im in irons', 'and a bottle \'o rum',
|
63
|
+
'and donae spare the whip', 'pass the grog',
|
64
|
+
'and swab the deck', 'fire the cannon',
|
65
|
+
'sleep with t\' fishes',
|
66
|
+
]
|
67
|
+
|
68
|
+
# Punctuation
|
69
|
+
punct = ['!', '.', '!!']
|
70
|
+
|
71
|
+
words = Array.new()
|
72
|
+
input = input.split(/ /)
|
73
|
+
input.each do|a|
|
74
|
+
#print "word: #{a}\n"
|
75
|
+
words.push(a)
|
76
|
+
end
|
77
|
+
|
78
|
+
words.each_index {|w|
|
79
|
+
if map.has_key?(words[w])
|
80
|
+
#print "Word: #{words[w]} Match: #{map[words[w]]}\n"
|
81
|
+
words[w] = map[words[w]]
|
82
|
+
end
|
83
|
+
}
|
84
|
+
|
85
|
+
sentence = words.join(" ")
|
86
|
+
#print "Sentence: #{sentence}\n"
|
87
|
+
|
88
|
+
if rand(5) + 1 == 1
|
89
|
+
sentence = fill[rand(fill.length)] << punct[rand(punct.length)] << " #{sentence}"
|
90
|
+
elsif rand(5) + 1 == 1
|
91
|
+
sentence = "#{sentence} " << fill[rand(fill.length)] << punct[rand(punct.length)]
|
92
|
+
end
|
93
|
+
|
94
|
+
#print "#{sentence}\n"
|
95
|
+
return sentence
|
96
|
+
end
|
97
|
+
end
|
data/spec/booty_spec.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
require 'booty'
|
3
|
+
|
4
|
+
describe Booty, '#call should except my booty call any dam time of the night!' do
|
5
|
+
{ 'this' => 'this', 'go' => 'sail', 'posted' => 'tacked to the yardarm' }.each do |key, value|
|
6
|
+
it "and turn '#{key}' into '#{value}'" do
|
7
|
+
Booty.call(key).include?(value).should be_true
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/spec/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: booty
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Deering
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-01-02 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Bring 'er alongside. Tis be eh Ruby gem that converts english t' pirate speak. Arrr.
|
17
|
+
email: mdeering@mdeering.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.textile
|
25
|
+
files:
|
26
|
+
- .gitignore
|
27
|
+
- LICENSE
|
28
|
+
- README.textile
|
29
|
+
- Rakefile
|
30
|
+
- VERSION
|
31
|
+
- booty.gemspec
|
32
|
+
- lib/booty.rb
|
33
|
+
- spec/booty_spec.rb
|
34
|
+
- spec/test_helper.rb
|
35
|
+
has_rdoc: true
|
36
|
+
homepage: http://github.com/mdeering/booty
|
37
|
+
licenses: []
|
38
|
+
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options:
|
41
|
+
- --charset=UTF-8
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: "0"
|
49
|
+
version:
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
version:
|
56
|
+
requirements: []
|
57
|
+
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 1.3.5
|
60
|
+
signing_key:
|
61
|
+
specification_version: 3
|
62
|
+
summary: Bring 'er alongside. Tis be eh Ruby gem that converts english t' pirate speak. Arrr.
|
63
|
+
test_files:
|
64
|
+
- spec/booty_spec.rb
|
65
|
+
- spec/test_helper.rb
|