talk_like_a_pirate 0.0.6 → 0.1.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/Gemfile +7 -1
- data/Gemfile.lock +16 -77
- data/README.md +3 -1
- data/Rakefile +7 -0
- data/lib/talk_like_a_pirate.rb +9 -7
- data/lib/talk_like_a_pirate/pirate_booty.yml +12 -5
- data/spec/lib/talk_like_a_pirate_spec.rb +57 -0
- data/talk_like_a_pirate.gemspec +11 -8
- metadata +33 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db932721c1e5caeccac58345b7379689344ef469
|
4
|
+
data.tar.gz: d2dd475fec4e4ed4a7728e0996f0ed236f7f56bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15454681ef634d24030283d78ca7078c0c33298c261a79983641c29b32ab3129794164b3ac14e518e2e9e7c56ac23c3c618861ffa8367bfed4b01548f2635d6b
|
7
|
+
data.tar.gz: 4cd7aa50c037cacf5c4de9fae228d28d381c63528afeb461430e4f319f606f0ba7a3d19f3155a7eb27a28b53d3e5af3366f3879ff31fb0556abf8c2eb7cd3241
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,85 +1,24 @@
|
|
1
1
|
GEM
|
2
|
+
remote: https://rubygems.org/
|
2
3
|
specs:
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
actionpack (3.2.13)
|
7
|
-
activemodel (= 3.2.13)
|
8
|
-
activesupport (= 3.2.13)
|
9
|
-
builder (~> 3.0.0)
|
10
|
-
erubis (~> 2.7.0)
|
11
|
-
journey (~> 1.0.4)
|
12
|
-
rack (~> 1.4.5)
|
13
|
-
rack-cache (~> 1.2)
|
14
|
-
rack-test (~> 0.6.1)
|
15
|
-
sprockets (~> 2.2.1)
|
16
|
-
activemodel (3.2.13)
|
17
|
-
activesupport (= 3.2.13)
|
18
|
-
builder (~> 3.0.0)
|
19
|
-
activerecord (3.2.13)
|
20
|
-
activemodel (= 3.2.13)
|
21
|
-
activesupport (= 3.2.13)
|
22
|
-
arel (~> 3.0.2)
|
23
|
-
tzinfo (~> 0.3.29)
|
24
|
-
activeresource (3.2.13)
|
25
|
-
activemodel (= 3.2.13)
|
26
|
-
activesupport (= 3.2.13)
|
27
|
-
activesupport (3.2.13)
|
28
|
-
i18n (= 0.6.1)
|
29
|
-
multi_json (~> 1.0)
|
30
|
-
arel (3.0.2)
|
31
|
-
builder (3.0.4)
|
32
|
-
erubis (2.7.0)
|
33
|
-
hike (1.2.2)
|
34
|
-
i18n (0.6.1)
|
35
|
-
journey (1.0.4)
|
36
|
-
json (1.7.7)
|
37
|
-
mail (2.5.3)
|
38
|
-
i18n (>= 0.4.0)
|
39
|
-
mime-types (~> 1.16)
|
40
|
-
treetop (~> 1.4.8)
|
41
|
-
mime-types (1.22)
|
42
|
-
multi_json (1.7.2)
|
43
|
-
polyglot (0.3.3)
|
44
|
-
rack (1.4.5)
|
45
|
-
rack-cache (1.2)
|
46
|
-
rack (>= 0.4)
|
47
|
-
rack-ssl (1.3.3)
|
48
|
-
rack
|
49
|
-
rack-test (0.6.2)
|
50
|
-
rack (>= 1.0)
|
51
|
-
rails (3.2.13)
|
52
|
-
actionmailer (= 3.2.13)
|
53
|
-
actionpack (= 3.2.13)
|
54
|
-
activerecord (= 3.2.13)
|
55
|
-
activeresource (= 3.2.13)
|
56
|
-
activesupport (= 3.2.13)
|
57
|
-
bundler (~> 1.0)
|
58
|
-
railties (= 3.2.13)
|
59
|
-
railties (3.2.13)
|
60
|
-
actionpack (= 3.2.13)
|
61
|
-
activesupport (= 3.2.13)
|
62
|
-
rack-ssl (~> 1.3.2)
|
63
|
-
rake (>= 0.8.7)
|
64
|
-
rdoc (~> 3.4)
|
65
|
-
thor (>= 0.14.6, < 2.0)
|
4
|
+
activesupport (3.0.20)
|
5
|
+
diff-lcs (1.2.4)
|
6
|
+
i18n (0.6.4)
|
66
7
|
rake (10.0.4)
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
tilt (1.3.7)
|
76
|
-
treetop (1.4.12)
|
77
|
-
polyglot
|
78
|
-
polyglot (>= 0.3.1)
|
79
|
-
tzinfo (0.3.37)
|
8
|
+
rspec (2.13.0)
|
9
|
+
rspec-core (~> 2.13.0)
|
10
|
+
rspec-expectations (~> 2.13.0)
|
11
|
+
rspec-mocks (~> 2.13.0)
|
12
|
+
rspec-core (2.13.1)
|
13
|
+
rspec-expectations (2.13.0)
|
14
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
15
|
+
rspec-mocks (2.13.1)
|
80
16
|
|
81
17
|
PLATFORMS
|
82
18
|
ruby
|
83
19
|
|
84
20
|
DEPENDENCIES
|
85
|
-
|
21
|
+
activesupport (~> 3.0.0)
|
22
|
+
i18n
|
23
|
+
rake
|
24
|
+
rspec
|
data/README.md
CHANGED
@@ -3,7 +3,9 @@ Ahoy, mateys!
|
|
3
3
|
|
4
4
|
Delight yer users with the flavor of the high seas!
|
5
5
|
|
6
|
-
Add a pirate translation layer to your Rails app! Talk, like a Pirate!
|
6
|
+
Add a pirate translation layer to your Ruby or Rails app! Talk, like a Pirate!
|
7
|
+
|
8
|
+
Try the gem out on [Ahoy Mat.ee](http://www.ahoymat.ee "Translate web pages into pirate"), which allows you to translate any page on the public internets.
|
7
9
|
|
8
10
|
Translate English to Pirate on the fly!
|
9
11
|
----
|
data/Rakefile
ADDED
data/lib/talk_like_a_pirate.rb
CHANGED
@@ -8,7 +8,7 @@ private #####################################################################
|
|
8
8
|
|
9
9
|
def self.build_string(me_string)
|
10
10
|
sentence = translate_string(me_string)
|
11
|
-
if sentence.split(" ").length > 5 && rand(5) == 0
|
11
|
+
if sentence.split(" ").length > 5 && sentence.match(/[!.?]\Z/) && rand(5) == 0
|
12
12
|
sentence = prepare_original_sentence(sentence) + " " + build_piratey_sentence
|
13
13
|
end
|
14
14
|
sentence
|
@@ -34,19 +34,21 @@ private #####################################################################
|
|
34
34
|
if dictionary.has_key? singularize(word)
|
35
35
|
word = dictionary[singularize(word)]
|
36
36
|
pluralized ? pluralize(word) : word
|
37
|
-
elsif word[/ing\Z/]
|
38
|
-
word.sub(/ing\Z/, "in'")
|
39
|
-
elsif word[/ings\Z/]
|
40
|
-
word.sub(/ings\Z/, "in's")
|
41
37
|
else
|
42
|
-
word
|
38
|
+
translate_if_gerund word
|
43
39
|
end
|
44
40
|
end
|
45
41
|
|
46
42
|
def self.piratize(word)
|
47
43
|
if dictionary.has_key? word
|
48
44
|
dictionary[word]
|
49
|
-
|
45
|
+
else
|
46
|
+
translate_if_gerund word
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.translate_if_gerund(word)
|
51
|
+
if word[/ing\Z/]
|
50
52
|
word.sub(/ing\Z/, "in'")
|
51
53
|
elsif word[/ings\Z/]
|
52
54
|
word.sub(/ings\Z/, "in's")
|
@@ -12,6 +12,7 @@ dictionary:
|
|
12
12
|
belief: creed
|
13
13
|
between: betwixt
|
14
14
|
big: vast
|
15
|
+
boy: lad
|
15
16
|
bring: bring
|
16
17
|
boss: admiral
|
17
18
|
bourbon: rum
|
@@ -20,6 +21,7 @@ dictionary:
|
|
20
21
|
business: company
|
21
22
|
businesses: companies
|
22
23
|
calling: "callin'"
|
24
|
+
canada: "Great North"
|
23
25
|
cash: doubloons
|
24
26
|
cheat: hornswaggle
|
25
27
|
comments: yer words
|
@@ -46,11 +48,14 @@ dictionary:
|
|
46
48
|
hand: hook
|
47
49
|
hello: ahoy
|
48
50
|
hey: ahoy
|
51
|
+
hotel: inn
|
49
52
|
"i'm": i be
|
53
|
+
internet: series o' tubes
|
50
54
|
invalid: sunk
|
51
55
|
is: be
|
52
56
|
island: isle
|
53
57
|
"isn't": be not
|
58
|
+
"it's": "'tis"
|
54
59
|
jail: brig
|
55
60
|
kill: keelhaul
|
56
61
|
king: king
|
@@ -76,6 +81,7 @@ dictionary:
|
|
76
81
|
really: verily
|
77
82
|
relatives: kin
|
78
83
|
religion: creed
|
84
|
+
ring: ring
|
79
85
|
role: job
|
80
86
|
say: cry
|
81
87
|
seconds: ticks o' tha clock
|
@@ -94,6 +100,7 @@ dictionary:
|
|
94
100
|
to: t'
|
95
101
|
vodka: rum
|
96
102
|
we: our jolly crew
|
103
|
+
"we're": "we's"
|
97
104
|
wine: grog
|
98
105
|
whiskey: rum
|
99
106
|
whisky: rum
|
@@ -126,18 +133,18 @@ pirate_flavor:
|
|
126
133
|
- blow me down
|
127
134
|
- swab the poop deck
|
128
135
|
- ye landlubber
|
129
|
-
- "bring
|
130
|
-
- "hang
|
136
|
+
- "bring 'er alongside"
|
137
|
+
- "hang 'im from the yardarm"
|
131
138
|
- blow the man down
|
132
139
|
- let go and haul
|
133
140
|
- heave to
|
134
141
|
- take no prisoners
|
135
142
|
- belay that
|
136
143
|
- me bucko
|
137
|
-
- "lock
|
138
|
-
- "and a bottle
|
144
|
+
- "lock 'im in irons"
|
145
|
+
- "and a bottle 'o rum"
|
139
146
|
- and donae spare the whip
|
140
147
|
- pass the grog
|
141
148
|
- and swab the deck
|
142
149
|
- fire the cannon
|
143
|
-
- "sleep with t
|
150
|
+
- "sleep with t' fishes"
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'talk_like_a_pirate'
|
2
|
+
|
3
|
+
describe TalkLikeAPirate do
|
4
|
+
|
5
|
+
it "should make a word piratey" do
|
6
|
+
TalkLikeAPirate.translate('between').should == "betwixt"
|
7
|
+
end
|
8
|
+
|
9
|
+
it "shouldn't translate plural words without ActiveSupport" do
|
10
|
+
TalkLikeAPirate.translate("islands").should == 'islands'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should make gerunds piratey" do
|
14
|
+
TalkLikeAPirate.translate('having').should == "havin'"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should make plural gerunds piratey" do
|
18
|
+
TalkLikeAPirate.translate('havings').should == "havin's"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should properly capitalize single words" do
|
22
|
+
TalkLikeAPirate.translate('Boss').should == "Admiral"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should properly capitalize all caps words" do
|
26
|
+
TalkLikeAPirate.translate('BOSS').should == "ADMIRAL"
|
27
|
+
TalkLikeAPirate.translate('BOSS!!!!').should == "ADMIRAL!!!!"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should properly capitalize phrases" do
|
31
|
+
TalkLikeAPirate.translate('Bourbon Country').should == "Rum Land"
|
32
|
+
TalkLikeAPirate.translate('Bourbon country').should == "Rum land"
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should properly translate words with trailing punctuation" do
|
36
|
+
TalkLikeAPirate.translate('man!!!').should == "pirate!!!"
|
37
|
+
TalkLikeAPirate.translate('man!?!?!?!').should == "pirate!?!?!?!"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should properly translate plural gerunds with trailing punctuation" do
|
41
|
+
TalkLikeAPirate.translate('belongings!').should == "belongin's!"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should properly punctuate and translate words with leading and punctuation" do
|
45
|
+
TalkLikeAPirate.translate('"The boss said kill."').should == '"Tha admiral said keelhaul."'
|
46
|
+
TalkLikeAPirate.translate('"The boss said to kill the dude!"').split(" ")[0..6].join(" ").should == '"Tha admiral said t\' keelhaul tha pirate!"'
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should translate plural words when ActiveSupport's available" do
|
50
|
+
require "active_support"
|
51
|
+
require "active_support/inflector"
|
52
|
+
|
53
|
+
TalkLikeAPirate.translate("islands").should == 'isles'
|
54
|
+
TalkLikeAPirate.translate("men").should == 'pirates'
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
data/talk_like_a_pirate.gemspec
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |s|
|
3
|
-
s.name
|
4
|
-
s.version
|
5
|
-
s.authors
|
6
|
-
s.email
|
7
|
-
s.homepage
|
8
|
-
s.summary
|
3
|
+
s.name = 'talk_like_a_pirate'
|
4
|
+
s.version = '0.1.0'
|
5
|
+
s.authors = ['Steve Hodges']
|
6
|
+
s.email = ['sjhodges@gmail.com']
|
7
|
+
s.homepage = 'https://github.com/stevehodges/talk_like_a_pirate'
|
8
|
+
s.summary = 'Talk Like A Pirate'
|
9
9
|
s.description = 'Add a pirate translation layer to your Rails app! Talk, like a Pirate!'
|
10
10
|
|
11
|
-
s.files
|
12
|
-
|
11
|
+
s.files = `git ls-files`.split("\n")
|
12
|
+
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
13
|
+
|
14
|
+
s.add_development_dependency 'rake'
|
15
|
+
s.add_development_dependency 'rspec'
|
13
16
|
s.require_paths = ['lib']
|
14
17
|
end
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: talk_like_a_pirate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Hodges
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
12
|
-
dependencies:
|
11
|
+
date: 2013-06-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
description: Add a pirate translation layer to your Rails app! Talk, like a Pirate!
|
14
42
|
email:
|
15
43
|
- sjhodges@gmail.com
|
@@ -20,10 +48,12 @@ files:
|
|
20
48
|
- Gemfile
|
21
49
|
- Gemfile.lock
|
22
50
|
- README.md
|
51
|
+
- Rakefile
|
23
52
|
- lib/talk_like_a_pirate.rb
|
24
53
|
- lib/talk_like_a_pirate/pirate_booty.yml
|
25
54
|
- lib/talk_like_a_pirate/railties.rb
|
26
55
|
- lib/talk_like_a_pirate/tasks/pirate.rake
|
56
|
+
- spec/lib/talk_like_a_pirate_spec.rb
|
27
57
|
- talk_like_a_pirate.gemspec
|
28
58
|
homepage: https://github.com/stevehodges/talk_like_a_pirate
|
29
59
|
licenses: []
|