talk_like_a_pirate 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/talk_like_a_pirate.rb +40 -8
- data/lib/talk_like_a_pirate/pirate_booty.yml +39 -5
- data/talk_like_a_pirate.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ba1542bb2d408ce91fddef7a6ed2e82385c1804
|
4
|
+
data.tar.gz: 8195bc83e94536f2887016a7c39dad776c8f0b73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4cc9b9256e697db5aa8854202192911701a488db780b5db59f78b703946d6fad12568f1f3c7b2c8c7bec97dde8c1e7e5d48d58b6144d8a3fa8657ec3f189247
|
7
|
+
data.tar.gz: 33ea4a5c0d5457d9ff2c476b45c452488391e98bd5f069ec22d6916cc5c3f1666d1632ba58a96e7f8249016f098c59cf3fc6d586c4ee4347e3c4ea34ba3ed976
|
data/lib/talk_like_a_pirate.rb
CHANGED
@@ -17,22 +17,46 @@ private #####################################################################
|
|
17
17
|
def self.translate_string(me_string)
|
18
18
|
me_string.split(/ /).map do |word|
|
19
19
|
capitalized = (word.slice(0,1) == word.slice(0,1).upcase)
|
20
|
-
|
21
|
-
|
20
|
+
fully_capitalized = (word == word.upcase)
|
21
|
+
word, punctuation = extract_punctuation word
|
22
|
+
word = Object.const_defined?(:ActiveSupport) ? piratize_with_pluralization(word.downcase) : piratize(word.downcase)
|
23
|
+
word = capitalize_first(word) if capitalized
|
24
|
+
word = word.upcase if fully_capitalized
|
25
|
+
word + punctuation
|
22
26
|
end.join(" ")
|
23
27
|
end
|
24
28
|
|
25
29
|
def self.piratize_with_pluralization(word)
|
26
|
-
pluralized =
|
27
|
-
if dictionary.has_key?
|
28
|
-
word = dictionary[
|
29
|
-
|
30
|
+
pluralized = pluralize(word) == word
|
31
|
+
if dictionary.has_key? singularize(word)
|
32
|
+
word = dictionary[singularize(word)]
|
33
|
+
pluralized ? pluralize(word) : word
|
34
|
+
elsif word[/ing\Z/]
|
35
|
+
word.sub(/ing\Z/, "in'")
|
36
|
+
elsif word[/ings\Z/]
|
37
|
+
word.sub(/ings\Z/, "in's")
|
38
|
+
else
|
39
|
+
word
|
30
40
|
end
|
31
|
-
word
|
32
41
|
end
|
33
42
|
|
34
43
|
def self.piratize(word)
|
35
|
-
dictionary.has_key?
|
44
|
+
if dictionary.has_key? word
|
45
|
+
dictionary[word]
|
46
|
+
elsif word[/ing\Z/]
|
47
|
+
word.sub(/ing\Z/, "in'")
|
48
|
+
elsif word[/ings\Z/]
|
49
|
+
word.sub(/ings\Z/, "in's")
|
50
|
+
else
|
51
|
+
word
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.extract_punctuation(word)
|
56
|
+
parts = word.match(/\A([a-zA-Z\'\-]+)([^a-zA-Z\'\-]*)\Z/)
|
57
|
+
word = parts[1] rescue word
|
58
|
+
punctuation = parts[2] rescue ""
|
59
|
+
return word, punctuation
|
36
60
|
end
|
37
61
|
|
38
62
|
def self.prepare_original_sentence(sentence)
|
@@ -79,6 +103,14 @@ private #####################################################################
|
|
79
103
|
string.slice(0,1).capitalize + string.slice(1..-1)
|
80
104
|
end
|
81
105
|
|
106
|
+
def self.singularize(word)
|
107
|
+
ActiveSupport::Inflector.singularize(word)
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.pluralize(word)
|
111
|
+
ActiveSupport::Inflector.pluralize(word)
|
112
|
+
end
|
113
|
+
|
82
114
|
end
|
83
115
|
|
84
116
|
if Object.const_defined? :Rails
|
@@ -1,30 +1,43 @@
|
|
1
1
|
locale: "arr"
|
2
2
|
dictionary:
|
3
|
-
account: debtor
|
4
3
|
address: port o' call
|
5
4
|
admin: helm
|
6
5
|
am: be
|
7
6
|
an: a
|
8
7
|
and: "n'"
|
9
8
|
are: be
|
9
|
+
award: prize
|
10
10
|
beer: grog
|
11
11
|
before: afore
|
12
|
+
belief: creed
|
13
|
+
between: betwixt
|
12
14
|
big: vast
|
15
|
+
bring: bring
|
13
16
|
boss: admiral
|
17
|
+
bourbon: rum
|
18
|
+
box: barrel
|
19
|
+
bring: bring
|
14
20
|
business: company
|
15
21
|
businesses: companies
|
16
22
|
calling: "callin'"
|
23
|
+
cash: doubloons
|
17
24
|
cheat: hornswaggle
|
18
25
|
comments: yer words
|
19
|
-
country:
|
26
|
+
country: land
|
20
27
|
dashboard: shanty
|
21
28
|
disconnect: keelhaul
|
22
29
|
do: "d'"
|
30
|
+
dollar: doubloon
|
31
|
+
dude: pirate
|
23
32
|
employee: crew
|
24
33
|
everyone: all hands
|
25
34
|
eye: eye-patch
|
35
|
+
family: kin
|
36
|
+
fee: debt
|
37
|
+
female: wench
|
26
38
|
for: fer
|
27
39
|
friend: shipmate
|
40
|
+
gin: rum
|
28
41
|
girl: lass
|
29
42
|
girls: lassies
|
30
43
|
go: sail
|
@@ -33,15 +46,22 @@ dictionary:
|
|
33
46
|
hand: hook
|
34
47
|
hello: ahoy
|
35
48
|
hey: ahoy
|
36
|
-
home: shanty
|
37
49
|
"i'm": i be
|
38
50
|
invalid: sunk
|
39
51
|
is: be
|
52
|
+
island: isle
|
40
53
|
"isn't": be not
|
54
|
+
jail: brig
|
41
55
|
kill: keelhaul
|
56
|
+
king: king
|
42
57
|
leg: peg
|
58
|
+
lady: lass
|
43
59
|
logout: walk the plank
|
60
|
+
male: pirate
|
61
|
+
man: pirate
|
44
62
|
manager: admiral
|
63
|
+
money: doubloons
|
64
|
+
month: moon
|
45
65
|
my: me
|
46
66
|
never: nary
|
47
67
|
no: nay
|
@@ -50,28 +70,42 @@ dictionary:
|
|
50
70
|
page: parchment
|
51
71
|
person: scallywag
|
52
72
|
posted: tacked to the yardarm
|
73
|
+
president: king
|
74
|
+
prison: brig
|
53
75
|
quickly: smartly
|
54
76
|
really: verily
|
77
|
+
relatives: kin
|
78
|
+
religion: creed
|
55
79
|
role: job
|
56
80
|
say: cry
|
81
|
+
seconds: ticks o' tha clock
|
57
82
|
shipping: cargo
|
58
83
|
small: puny
|
84
|
+
soldier: sailor
|
59
85
|
sorry: yarr
|
60
|
-
|
86
|
+
spouse: ball 'n' chain
|
87
|
+
state: land
|
61
88
|
supervisor: "Cap'n"
|
62
89
|
"that's": that be
|
63
90
|
the: tha
|
64
91
|
them: "'em"
|
92
|
+
thing: thing
|
65
93
|
this: dis
|
66
94
|
to: t'
|
95
|
+
vodka: rum
|
67
96
|
we: our jolly crew
|
97
|
+
wine: grog
|
98
|
+
whiskey: rum
|
99
|
+
whisky: rum
|
100
|
+
with: wit'
|
68
101
|
woman: wench
|
69
|
-
work:
|
102
|
+
work: duty
|
70
103
|
yah: aye
|
71
104
|
yeah: aye
|
72
105
|
yes: aye
|
73
106
|
you: ye
|
74
107
|
"you're": you be
|
108
|
+
"you've": ye
|
75
109
|
your: yer
|
76
110
|
|
77
111
|
pirate_flavor:
|
data/talk_like_a_pirate.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = 'talk_like_a_pirate'
|
4
|
-
s.version = '0.0.
|
4
|
+
s.version = '0.0.5'
|
5
5
|
s.authors = ['Steve Hodges']
|
6
6
|
s.email = ['sjhodges@gmail.com']
|
7
7
|
s.homepage = 'https://github.com/stevehodges/talk_like_a_pirate'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.0.5
|
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-
|
11
|
+
date: 2013-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Add a pirate translation layer to your Rails app! Talk, like a Pirate!
|
14
14
|
email:
|