talk_like_a_pirate 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5244fd897c561f4fe415ea87d7ace18fe3482ef9
4
+ data.tar.gz: 64b9fafc6bacf5f0cf41c09b7470bfbdc1ed4a14
5
+ SHA512:
6
+ metadata.gz: 82335ef3a999b5056db7ab5d1fd4cbb732ae2ebd8a246f75499787865c0278cc62c217d19f3eca7db27d7c392ac93f0679eebff05d3d4aee2e37209b16dd832e
7
+ data.tar.gz: 9388391f55e909994b1a6e3b5d1b6a9a9e60de629dc61fab5bfd8a3599907775df70c86db7839a533e60aacc47129c0b97d34b68124d475115af63604ef9590d
data/README.md CHANGED
@@ -41,6 +41,20 @@ And format it like so (all keys are optional):
41
41
  pirate_flavor: # the flavoring occasionally added to the ends of sentences
42
42
  - "T' Davy Jones' locker wit ya"
43
43
 
44
+ Using Ruby without Rails?
45
+ ----
46
+ TalkLikeAPirate works great on Ruby (without Rails) as-is.
47
+
48
+ If you want more sophistication in your translations, you can add the Rails ActiveSupport gem for translating singular and plural versions of words. In your project, be sure to:
49
+
50
+ require "active_support"
51
+ require "active_support/inflector"
52
+
53
+ And, due to dependency weirdness in ActiveSupport, you'll also need the i18n gem installed. So, in your Gemfile:
54
+
55
+ gem 'activesupport', '~> 3.0.0'
56
+ gem 'i18n'
57
+
44
58
  Contributions
45
59
  =====
46
60
  Feel free to write specs, add to the standard dictionary, etc. Submit a pull request and we'll see what happens!
@@ -17,16 +17,16 @@ 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
- word = rails_present? ? piratize_with_pluralization(word) : piratize(word)
20
+ word = Object.const_defined?(:ActiveSupport) ? piratize_with_pluralization(word) : piratize(word)
21
21
  capitalized ? capitalize_first(word) : word
22
22
  end.join(" ")
23
23
  end
24
24
 
25
25
  def self.piratize_with_pluralization(word)
26
- pluralized = word.pluralize == word
27
- if dictionary.has_key?(word.downcase.singularize)
28
- word = dictionary[word.downcase.singularize]
29
- word = pluralized ? word.pluralize : word
26
+ pluralized = ActiveSupport::Inflector.pluralize(word) == word
27
+ if dictionary.has_key? ActiveSupport::Inflector.singularize(word.downcase)
28
+ word = dictionary[ActiveSupport::Inflector.singularize(word.downcase)]
29
+ word = pluralized ? ActiveSupport::Inflector.pluralize(word) : word
30
30
  end
31
31
  word
32
32
  end
@@ -79,10 +79,6 @@ private #####################################################################
79
79
  string.slice(0,1).capitalize + string.slice(1..-1)
80
80
  end
81
81
 
82
- def self.rails_present?
83
- Object.const_defined? :Rails
84
- end
85
-
86
82
  end
87
83
 
88
84
  if Object.const_defined? :Rails
@@ -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.3'
4
+ s.version = '0.0.4'
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,15 +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.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Steve Hodges
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-02 00:00:00.000000000 Z
11
+ date: 2013-06-05 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Add a pirate translation layer to your Rails app! Talk, like a Pirate!
15
14
  email:
@@ -28,26 +27,25 @@ files:
28
27
  - talk_like_a_pirate.gemspec
29
28
  homepage: https://github.com/stevehodges/talk_like_a_pirate
30
29
  licenses: []
30
+ metadata: {}
31
31
  post_install_message:
32
32
  rdoc_options: []
33
33
  require_paths:
34
34
  - lib
35
35
  required_ruby_version: !ruby/object:Gem::Requirement
36
- none: false
37
36
  requirements:
38
- - - ! '>='
37
+ - - '>='
39
38
  - !ruby/object:Gem::Version
40
39
  version: '0'
41
40
  required_rubygems_version: !ruby/object:Gem::Requirement
42
- none: false
43
41
  requirements:
44
- - - ! '>='
42
+ - - '>='
45
43
  - !ruby/object:Gem::Version
46
44
  version: '0'
47
45
  requirements: []
48
46
  rubyforge_project:
49
- rubygems_version: 1.8.23
47
+ rubygems_version: 2.0.2
50
48
  signing_key:
51
- specification_version: 3
49
+ specification_version: 4
52
50
  summary: Talk Like A Pirate
53
51
  test_files: []