spanglify 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 250d06256c760bad68267e33e4d3ba438213498fd3a1e8aa94632cf75067a13e
4
- data.tar.gz: 302b4c28d275b7d0013e822d300eae6b4b7ea0210dee4bb9874301b1be1ef206
3
+ metadata.gz: dd52ce2dca88a392a0affa1fa8c1b9ddcbe3ac33da0aa81590ee1887181dc240
4
+ data.tar.gz: acd04793d40b16d4600dd7150f759fe404219054357c6ee176facd64268dd385
5
5
  SHA512:
6
- metadata.gz: 1b293e8547e371a29585de6347e0156a016ee01adb840116af9c9caaafb6d24ad868a9b49e1a2bc53398d843698aa99ce673c9a023d75464b477fa4813bcb584
7
- data.tar.gz: 8bb8bb4098aec816db32bf79c96ddb94684e28a437d60bc26b87a276f1ad27e50af5d9850705f5eb7e642733db25999843a079c970a5d9a280cee98fe1a799a0
6
+ metadata.gz: 52cc53ddb0004e1dc935c981491a8c954972af1e29f22659094a1d9bb0baf21c3a748e45193b0b4c69f52287be90d74c45a21b57264cac0ad8639737afb8d736
7
+ data.tar.gz: ed96869e54e2946832b6719c973ab0966c81175a4b0593f703527b7a579fc365605d4afa0ee0ca50119bb162c355764f40d50bd54e874d9f13c78926759a9da2
@@ -2,18 +2,32 @@ require "spanglify/version"
2
2
 
3
3
  module Spanglify
4
4
  def self.process(str)
5
- str = str.downcase
5
+ #commonly interchanged English to Spanish words and phrases
6
6
  to_swap = {
7
7
  "are you" => "estás",
8
8
  "very" => "muy",
9
9
  "but" => "pero",
10
- "I like" => "me gusta",
10
+ "i like" => "me gusta",
11
11
  "party" => "fiesta",
12
- "with" => "con",
13
- "to check" => "chequear"
12
+ "with" => "con"
14
13
  }
15
14
 
16
- spanglish = to_swap.inject(str) {|str, (k, v)| str.gsub(k,v)}
17
- spanglish.capitalize
15
+ to_swap.each do |key, value|
16
+ #create a capitalized versions of the key and values
17
+ capitalized_key = key.capitalize
18
+ capitalized_value = value.capitalize
19
+
20
+ upcase_key = key.upcase
21
+ upcase_value = value.upcase
22
+
23
+ if str.include? "#{key}" #if the string contains the lowercase version of the English word(s)
24
+ str.gsub!(key, value) #swap out for the lowercase Spanish version of the word(s)
25
+ elsif str.include? "#{upcase_key}" #if the string contains the capitalized version of the English word(s)
26
+ str.gsub!(upcase_key, upcase_value) #swap out for the capitalized version of the Spanish word(s)
27
+ elsif str.include? "#{capitalized_key}" #if the string contains the uppercase version of the English word(s)
28
+ str.gsub!(capitalized_key, capitalized_value) #swap out for the uppercase version of the Spanish word(s)
29
+ end
30
+ end
31
+ str #return the spanglified version of the string
18
32
  end
19
33
  end
@@ -1,3 +1,3 @@
1
1
  module Spanglify
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spanglify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephanie Fischler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-07 00:00:00.000000000 Z
11
+ date: 2019-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,5 +83,5 @@ requirements: []
83
83
  rubygems_version: 3.0.4
84
84
  signing_key:
85
85
  specification_version: 4
86
- summary: Convert English phrases into the Spanish-English hybrid languagh, Spanglish
86
+ summary: Converts English phrases into the Spanish-English hybrid languagh, Spanglish
87
87
  test_files: []