talk_like_a_pirate 0.0.5 → 0.0.6
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/lib/talk_like_a_pirate.rb +10 -6
- 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: 21719ae4e6616e108be5a05a12826e0271950d3f
|
4
|
+
data.tar.gz: 39a93c6e990f33b6b539703d91d5618589b2b694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1652ede1f66dffe8f2f26a3a4f3338d321fb8e79c75ee49310362957bb6abb58fb65cc7aaa57f19466d3e08f9dc8416cc48a0bae6d1ece1d6b3cb86458833529
|
7
|
+
data.tar.gz: 2a36206aee8ad64c9b790bdf4810ad8eeae08c84bc11502a7767c249fda25d8899a44f3a18c439606161367b01d52dba1758bdbf0baef28845ee3d389fc7209f
|
data/lib/talk_like_a_pirate.rb
CHANGED
@@ -16,13 +16,16 @@ private #####################################################################
|
|
16
16
|
|
17
17
|
def self.translate_string(me_string)
|
18
18
|
me_string.split(/ /).map do |word|
|
19
|
+
|
20
|
+
leading_punctuation, word, trailing_punctuation = extract_punctuation word
|
19
21
|
capitalized = (word.slice(0,1) == word.slice(0,1).upcase)
|
20
22
|
fully_capitalized = (word == word.upcase)
|
21
|
-
|
23
|
+
|
22
24
|
word = Object.const_defined?(:ActiveSupport) ? piratize_with_pluralization(word.downcase) : piratize(word.downcase)
|
25
|
+
|
23
26
|
word = capitalize_first(word) if capitalized
|
24
27
|
word = word.upcase if fully_capitalized
|
25
|
-
word
|
28
|
+
"#{leading_punctuation}#{word}#{trailing_punctuation}"
|
26
29
|
end.join(" ")
|
27
30
|
end
|
28
31
|
|
@@ -53,10 +56,11 @@ private #####################################################################
|
|
53
56
|
end
|
54
57
|
|
55
58
|
def self.extract_punctuation(word)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
59
|
+
leading_punctuation = word.match(/\A([^a-zA-Z]*)/)[1] rescue ""
|
60
|
+
trailing_punctuation = word.match(/[a-zA-Z]+([^a-zA-Z]*)\Z/)[1] rescue ""
|
61
|
+
word_length = word.length - leading_punctuation.length - trailing_punctuation.length
|
62
|
+
word = word[leading_punctuation.length, word_length]
|
63
|
+
return leading_punctuation, word, trailing_punctuation
|
60
64
|
end
|
61
65
|
|
62
66
|
def self.prepare_original_sentence(sentence)
|
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.6'
|
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.6
|
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-10 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:
|