anglicize 0.0.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95b176408a8b9f1ce6743184a5b99ce5917851c8
4
- data.tar.gz: 631d80afbfa16ebb1f42e79622afe43ec1cf002c
3
+ metadata.gz: edc9f7a4e2a4f05e656bdb23c45989c3a290bd1d
4
+ data.tar.gz: bdd3df1f090eebe8f5091236784f85ef1ce694ed
5
5
  SHA512:
6
- metadata.gz: 2a97f0de624f7a7f24f928aab7b898ca24de62891294a34481583a189cd698204dbf65587a4d810ef30efb5ebf5dc1685dffd19b491f5a8c9fcce08c3792c606
7
- data.tar.gz: 4e8ab6cb7d30505b68e136b010262aaf136ee81cb0c72104052cddc27eef8cbf728a76ea664c78ea4dbd06e51741ec2b36f4b05881d40f2682b4fc1ab0676377
6
+ metadata.gz: a46ba1bde66a66b426d9e944c8964d583b69bc147e78cec95db061b58a39f41ebdcbab48549c6703036b49faba7e56d7ca9ef4ceb56ac03f9788e4c0a81136c6
7
+ data.tar.gz: 1172df5278059b95825f772e42eb3bec8d03d5a85e22bf148b0c31825e0e028fbbb29f9b29abc66697858cf48f31015986cce22408c5387017a8226ede13deaa
data/Rakefile CHANGED
@@ -14,9 +14,6 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
-
18
-
19
-
20
17
  Bundler::GemHelper.install_tasks
21
18
 
22
19
  require 'rake/testtask'
@@ -28,5 +25,4 @@ Rake::TestTask.new(:test) do |t|
28
25
  t.verbose = false
29
26
  end
30
27
 
31
-
32
28
  task default: :test
@@ -1,2 +1 @@
1
1
  require 'anglicize/string'
2
-
@@ -12,7 +12,7 @@ class String
12
12
  # Converts the string into English spelling.
13
13
  # @return [String] the string converted into English spelling
14
14
  def anglicize!
15
- self.replace(self.anglicize)
15
+ replace(anglicize)
16
16
  end
17
17
 
18
18
  # @return [String] a copy of the string converted into American spelling.
@@ -25,7 +25,7 @@ class String
25
25
  # Converts the string into American spelling.
26
26
  # @return [String] the string converted into American spelling
27
27
  def americanize!
28
- self.replace(self.americanize)
28
+ replace(americanize)
29
29
  end
30
30
 
31
31
  # @return [Boolean] a value indicating whether the English spelling differs.
@@ -41,15 +41,15 @@ class String
41
41
  # @param word [String] used as the case template
42
42
  # @return [String] a copy of the string with the same case as the template.
43
43
  def copy_case(word)
44
- result = ""
44
+ result = ''
45
45
  case word
46
46
  when word.upcase
47
- result = self.upcase
47
+ result = upcase
48
48
  when word.downcase
49
- result = self.downcase
49
+ result = downcase
50
50
  else
51
- self.chars.each_with_index do |char, index|
52
- word_char = word[index] || "a"
51
+ chars.each_with_index do |char, index|
52
+ word_char = word[index] || 'a'
53
53
  result << (word_char.upcase == word_char ? char.upcase : char.downcase)
54
54
  end
55
55
  end
@@ -59,17 +59,17 @@ class String
59
59
  # Changes the string to have the same case as the string parameter.
60
60
  # @param word [String] used as the case template
61
61
  # @return [String] the string with the same case as the template.
62
- def copy_case!(word)
63
- self.replace(self.copy_case)
62
+ def copy_case!(_word)
63
+ replace(copy_case)
64
64
  end
65
65
 
66
66
  private
67
67
 
68
68
  # A regular expression for identifying words
69
- WORD_RE = /\b[a-zA-Z]+\b/
69
+ WORD_RE = /\b[a-zA-Z]+\b/.freeze
70
70
 
71
71
  def convert_all_words(conversion_hash)
72
- result = self.dup
72
+ result = dup
73
73
  scan(WORD_RE).uniq.each do |word|
74
74
  replacement = get_word_from_conversion_hash(conversion_hash, word)
75
75
  result.gsub!(/\b#{word}\b/, replacement)
@@ -95,7 +95,7 @@ class String
95
95
 
96
96
  def load_alternate_spellings
97
97
  dirname = File.dirname(File.expand_path(__FILE__))
98
- file_path = File.join(dirname, "alternate_spellings.yml")
99
- YAML::load(File.open(file_path))
98
+ file_path = File.join(dirname, 'alternate_spellings.yml')
99
+ YAML.safe_load(File.open(file_path))
100
100
  end
101
- end
101
+ end
@@ -1,5 +1,5 @@
1
1
  # default module
2
2
  module Anglicize
3
3
  # version number
4
- VERSION = "0.0.3"
4
+ VERSION = '0.1.0'.freeze
5
5
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anglicize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Webb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-26 00:00:00.000000000 Z
11
+ date: 2019-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '2'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: yard
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0.8'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0.8'
40
+ version: '0'
41
41
  description: Converts strings from American spelling to English spelling and vice
42
42
  versa.
43
43
  email:
@@ -74,9 +74,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  version: '0'
75
75
  requirements: []
76
76
  rubyforge_project:
77
- rubygems_version: 2.3.0
77
+ rubygems_version: 2.6.13
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Converts strings from American spelling to English spelling and vice versa.
81
81
  test_files: []
82
- has_rdoc: