owoify_rb 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20ca6820ead683de7e6057a90aeb1982be6bac15c25de8c27716c6bfeff87e4e
4
- data.tar.gz: 6dbb2b6f58e1a23d59d1f3c93cd0faa496effcc2f80f07a412c152b2d1ea4196
3
+ metadata.gz: 2b497d9273a9d0c4bebc22ed77e3ce53c91927025b3bb0b6f0f163fd29f32763
4
+ data.tar.gz: c3d63ee03bc86c20f2745a7dfdbb3cbbbb9ce9d11c6c4fbece1d7ec0d08c8cc7
5
5
  SHA512:
6
- metadata.gz: e544218dd8762b8d4b7b4ea60655bb0fcbb827142d8d1960cdcef28576e448325b8f524ebe195cc2dc4931a1a2d88e93d9e6ce0be17a9578676e062d50383671
7
- data.tar.gz: 75284d62ee51d98f4f0a0e65e61dbfa8cd3102f64a51faea52cde6cbc347c8685e66526e51f3958d50319cdd34f4c29e95b094743a80906c9e979deafeda00a4
6
+ metadata.gz: 0d5bffe0b326d4a2e1eeaa0b3626d9140a7a445fa66df206db409e793104230d10b1341223b3ed8956d2f660397f53384e73d268cda2baf70511f3cfb1ee9868
7
+ data.tar.gz: 12fe19105c9fa150cffa701688afb0934003f4019605b0a4db1362c604bf7de53cfc66becb9f74573b016a8ec508483e5bb3df019be7f775782c008ccb324b7b
data/lib/owoify_rb.rb CHANGED
@@ -4,7 +4,11 @@ require 'structures/word'
4
4
  require 'utility/interleave_arrays'
5
5
  require 'utility/presets'
6
6
 
7
+ # Owoify module is the main module where owoify function lies in.
8
+ # Since owoify is literally just a function, users are expected to invoke owoify by calling Owoify.owoify().
7
9
  module Owoify
10
+ # The main entry point of the owoify function.
11
+ # Pass in the source string and the desired owoify level.
8
12
  def self.owoify(source, level = 'owo')
9
13
  word_matches = source.scan(/[^\s]+/).flatten
10
14
  space_matches = source.scan(/\s+/).flatten
@@ -87,8 +87,8 @@ module Mapping
87
87
  end
88
88
 
89
89
  MAP_DEAD_TO_DED = lambda do |input|
90
- input = input.replace(DEAD_TO_DED_UPPER, 'Ded')
91
- input.replace(DEAD_TO_DED_LOWER, 'ded')
90
+ input.replace(DEAD_TO_DED_UPPER, 'Ded')
91
+ .replace(DEAD_TO_DED_LOWER, 'ded')
92
92
  end
93
93
 
94
94
  MAP_N_VOWEL_T_TO_ND = lambda do |input|
@@ -96,33 +96,32 @@ module Mapping
96
96
  end
97
97
 
98
98
  MAP_READ_TO_WEAD = lambda do |input|
99
- input = input.replace(READ_TO_WEAD_UPPER, 'Wead')
100
- input.replace(READ_TO_WEAD_LOWER, 'wead')
99
+ input.replace(READ_TO_WEAD_UPPER, 'Wead')
100
+ .replace(READ_TO_WEAD_LOWER, 'wead')
101
101
  end
102
102
 
103
103
  MAP_BRACKETS_TO_STAR_TRAILS = lambda do |input|
104
- input = input.replace(BRACKETS_TO_STARTRAILS_FORE, '。・:*:・゚★,。・:*:・゚☆')
105
- input.replace(BRACKETS_TO_STARTRAILS_REAR, '☆゚・:*:・。,★゚・:*:・。')
104
+ input.replace(BRACKETS_TO_STARTRAILS_FORE, '。・:*:・゚★,。・:*:・゚☆')
105
+ .replace(BRACKETS_TO_STARTRAILS_REAR, '☆゚・:*:・。,★゚・:*:・。')
106
106
  end
107
107
 
108
108
  MAP_PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS = lambda do |input|
109
- num = rand * FACES.length
110
- index = num.floor
111
- input = input.replace_with_func_single(PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS_FIRST, lambda { " #{FACES[index]}" })
112
-
113
- num = rand * FACES.length
114
- index = num.floor
115
- input.replace_with_func_single(PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS_SECOND, lambda { " #{FACES[index]}" })
109
+ input.replace_with_func_single(PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS_FIRST, lambda {
110
+ " #{FACES[rand(FACES.length)]}"
111
+ })
112
+ .replace_with_func_single(PERIOD_COMMA_EXCLAMATION_SEMICOLON_TO_KAOMOJIS_SECOND, lambda {
113
+ " #{FACES[rand(FACES.length)]}"
114
+ })
116
115
  end
117
116
 
118
117
  MAP_THAT_TO_DAT = lambda do |input|
119
- input = input.replace(THAT_TO_DAT_LOWER, 'dat')
120
- input.replace(THAT_TO_DAT_UPPER, 'Dat')
118
+ input.replace(THAT_TO_DAT_LOWER, 'dat')
119
+ .replace(THAT_TO_DAT_UPPER, 'Dat')
121
120
  end
122
121
 
123
122
  MAP_TH_TO_F = lambda do |input|
124
- input = input.replace(TH_TO_F_LOWER, 'f')
125
- input.replace(TH_TO_F_UPPER, 'F')
123
+ input.replace(TH_TO_F_LOWER, 'f')
124
+ .replace(TH_TO_F_UPPER, 'F')
126
125
  end
127
126
 
128
127
  MAP_LE_TO_WAL = lambda do |input|
@@ -130,8 +129,8 @@ module Mapping
130
129
  end
131
130
 
132
131
  MAP_VE_TO_WE = lambda do |input|
133
- input = input.replace(VE_TO_WE_LOWER, 'we')
134
- input.replace(VE_TO_WE_UPPER, 'We')
132
+ input.replace(VE_TO_WE_LOWER, 'we')
133
+ .replace(VE_TO_WE_UPPER, 'We')
135
134
  end
136
135
 
137
136
  MAP_RY_TO_WWY = lambda do |input|
@@ -139,8 +138,8 @@ module Mapping
139
138
  end
140
139
 
141
140
  MAP_R_OR_L_TO_W = lambda do |input|
142
- input = input.replace(RORL_TO_W_LOWER, 'w')
143
- input.replace(RORL_TO_W_UPPER, 'W')
141
+ input.replace(RORL_TO_W_LOWER, 'w')
142
+ .replace(RORL_TO_W_UPPER, 'W')
144
143
  end
145
144
 
146
145
  MAP_LL_TO_WW = lambda do |input|
@@ -148,33 +147,33 @@ module Mapping
148
147
  end
149
148
 
150
149
  MAP_VOWEL_OR_R_EXCEPT_O_L_TO_WL = lambda do |input|
151
- input = input.replace(VOWEL_OR_R_EXCEPT_O_L_TO_WL_LOWER, 'wl')
152
- input.replace(VOWEL_OR_R_EXCEPT_O_L_TO_WL_UPPER, 'W\1')
150
+ input.replace(VOWEL_OR_R_EXCEPT_O_L_TO_WL_LOWER, 'wl')
151
+ .replace(VOWEL_OR_R_EXCEPT_O_L_TO_WL_UPPER, 'W\1')
153
152
  end
154
153
 
155
154
  MAP_OLD_TO_OWLD = lambda do |input|
156
- input = input.replace(OLD_TO_OWLD_LOWER, '\1wld')
157
- input.replace(OLD_TO_OWLD_UPPER, 'OWLD')
155
+ input.replace(OLD_TO_OWLD_LOWER, '\1wld')
156
+ .replace(OLD_TO_OWLD_UPPER, 'OWLD')
158
157
  end
159
158
 
160
159
  MAP_OL_TO_OWL = lambda do |input|
161
- input = input.replace(OL_TO_OWL_LOWER, '\1wl')
162
- input.replace(OL_TO_OWL_UPPER, 'OWL')
160
+ input.replace(OL_TO_OWL_LOWER, '\1wl')
161
+ .replace(OL_TO_OWL_UPPER, 'OWL')
163
162
  end
164
163
 
165
164
  MAP_L_OR_R_O_TO_WO = lambda do |input|
166
- input = input.replace(LORR_O_TO_WO_LOWER, 'wo')
167
- input.replace(LORR_O_TO_WO_UPPER, 'W\1')
165
+ input.replace(LORR_O_TO_WO_LOWER, 'wo')
166
+ .replace(LORR_O_TO_WO_UPPER, 'W\1')
168
167
  end
169
168
 
170
169
  MAP_SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO = lambda do |input|
171
- input = input.replace(SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO_LOWER, '\1wo')
172
- input.replace_with_func_multiple(SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO_UPPER, lambda do |s1, s2|
173
- msg = s1
174
- msg += s2.upcase == s2 ? 'W' : 'w'
175
- msg += s2
176
- msg
177
- end)
170
+ input.replace(SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO_LOWER, '\1wo')
171
+ .replace_with_func_multiple(SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO_UPPER, lambda do |s1, s2|
172
+ msg = s1
173
+ msg += s2.upcase == s2 ? 'W' : 'w'
174
+ msg += s2
175
+ msg
176
+ end)
178
177
  end
179
178
 
180
179
  MAP_V_OR_W_LE_TO_WAL = lambda do |input|
@@ -182,8 +181,8 @@ module Mapping
182
181
  end
183
182
 
184
183
  MAP_FI_TO_FWI = lambda do |input|
185
- input = input.replace(FI_TO_FWI_LOWER, '\1wi')
186
- input.replace(FI_TO_FWI_UPPER, 'FWI')
184
+ input.replace(FI_TO_FWI_LOWER, '\1wi')
185
+ .replace(FI_TO_FWI_UPPER, 'FWI')
187
186
  end
188
187
 
189
188
  MAP_VER_TO_WER = lambda do |input|
@@ -203,8 +202,8 @@ module Mapping
203
202
  end
204
203
 
205
204
  MAP_LY_TO_WY = lambda do |input|
206
- input = input.replace(LY_TO_WY_LOWER, 'wy')
207
- input.replace(LY_TO_WY_UPPER, 'Wy')
205
+ input.replace(LY_TO_WY_LOWER, 'wy')
206
+ .replace(LY_TO_WY_UPPER, 'Wy')
208
207
  end
209
208
 
210
209
  MAP_PLE_TO_PWE = lambda do |input|
@@ -212,8 +211,8 @@ module Mapping
212
211
  end
213
212
 
214
213
  MAP_NR_TO_NW = lambda do |input|
215
- input = input.replace(NR_TO_NW_LOWER, 'nw')
216
- input.replace(NR_TO_NW_UPPER, 'NW')
214
+ input.replace(NR_TO_NW_LOWER, 'nw')
215
+ .replace(NR_TO_NW_UPPER, 'NW')
217
216
  end
218
217
 
219
218
  MAP_FUC_TO_FWUC = lambda do |input|
@@ -229,14 +228,14 @@ module Mapping
229
228
  end
230
229
 
231
230
  MAP_N_VOWEL_TO_NY = lambda do |input|
232
- input = input.replace(N_VOWEL_TO_NY_FIRST, 'ny\1')
233
- input = input.replace(N_VOWEL_TO_NY_SECOND, 'Ny\1')
234
- input.replace(N_VOWEL_TO_NY_THIRD, 'NY\1')
231
+ input.replace(N_VOWEL_TO_NY_FIRST, 'ny\1')
232
+ .replace(N_VOWEL_TO_NY_SECOND, 'Ny\1')
233
+ .replace(N_VOWEL_TO_NY_THIRD, 'NY\1')
235
234
  end
236
235
 
237
236
  MAP_OVE_TO_UV = lambda do |input|
238
- input = input.replace(OVE_TO_UV_LOWER, 'uv')
239
- input.replace(OVE_TO_UV_UPPER, 'UV')
237
+ input.replace(OVE_TO_UV_LOWER, 'uv')
238
+ .replace(OVE_TO_UV_UPPER, 'UV')
240
239
  end
241
240
 
242
241
  MAP_HAHA_TO_HEHE_XD = lambda do |input|
@@ -248,8 +247,8 @@ module Mapping
248
247
  end
249
248
 
250
249
  MAP_YOU_TO_U = lambda do |input|
251
- input = input.replace(YOU_TO_U_UPPER, 'U')
252
- input.replace(YOU_TO_U_LOWER, 'u')
250
+ input.replace(YOU_TO_U_UPPER, 'U')
251
+ .replace(YOU_TO_U_LOWER, 'u')
253
252
  end
254
253
 
255
254
  MAP_TIME_TO_TIM = lambda do |input|
@@ -263,4 +262,4 @@ module Mapping
263
262
  MAP_WORSE_TO_WOSE = lambda do |input|
264
263
  input.replace(WORSE_TO_WOSE, '\1ose')
265
264
  end
266
- end
265
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: owoify_rb
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
  - Chehui Chou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-12 00:00:00.000000000 Z
11
+ date: 2021-03-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This is a Ruby port of mohan-cao's owoify-js, which will help you turn
14
14
  any string into nonsensical babyspeak similar to LeafySweet's infamous Chrome extension.