owoify_rb 0.1.0 → 1.0.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 +4 -4
- data/lib/owoify_rb.rb +8 -6
- data/lib/utility/interleave_arrays.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73be1acc0f30a91f9e109f0e17f0a8862740f76d2f3492582ba2018a187aabcc
|
4
|
+
data.tar.gz: 4b2b78c349f72689da97a4d2616e218fd33471b244c3b9e13b6f17031961b8c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38b9031fe92e33552ff008593a4bdbae9f780fdb595a80c5f32b0938c7a56f80c96899dd6fba08edf0b573ffce233ad98288dbc31c6fd20e764e00a098b68bf2
|
7
|
+
data.tar.gz: a5bd3503e6762d12799a8c1b36434809f036c071b75e075f1a8af6d6882eca6bf7c9f3997636b543609afabefab9080270d6cdffc19350e523769093e4227a73
|
data/lib/owoify_rb.rb
CHANGED
@@ -9,29 +9,31 @@ require 'utility/presets'
|
|
9
9
|
module Owoify
|
10
10
|
# The main entry point of the owoify function.
|
11
11
|
# Pass in the source string and the desired owoify level.
|
12
|
-
|
12
|
+
# @param [String] source The source string to owoify.
|
13
|
+
# @param [Symbol] level The desired owoness level of the result string.
|
14
|
+
# @return [String] The owoified string according to the specified owoness level.
|
15
|
+
def self.owoify(source, level = :owo)
|
13
16
|
word_matches = source.scan(/[^\s]+/).flatten
|
14
17
|
space_matches = source.scan(/\s+/).flatten
|
15
18
|
words = word_matches.map { |x| Word.new(x) }
|
16
19
|
spaces = space_matches.map { |x| Word.new(x) }
|
17
|
-
actual_level = level.downcase
|
18
20
|
words.map! do |w|
|
19
21
|
SPECIFIC_WORD_MAPPING_LIST.each do |f|
|
20
22
|
w = f.call(w)
|
21
23
|
end
|
22
|
-
case
|
23
|
-
when
|
24
|
+
case level
|
25
|
+
when :owo
|
24
26
|
OWO_MAPPING_LIST.each do |f|
|
25
27
|
w = f.call(w)
|
26
28
|
end
|
27
|
-
when
|
29
|
+
when :uwu
|
28
30
|
UWU_MAPPING_LIST.each do |f|
|
29
31
|
w = f.call(w)
|
30
32
|
end
|
31
33
|
OWO_MAPPING_LIST.each do |f|
|
32
34
|
w = f.call(w)
|
33
35
|
end
|
34
|
-
when
|
36
|
+
when :uvu
|
35
37
|
UVU_MAPPING_LIST.each do |f|
|
36
38
|
w = f.call(w)
|
37
39
|
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:
|
4
|
+
version: 1.0.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:
|
11
|
+
date: 2022-04-24 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.
|
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: '0'
|
44
44
|
requirements: []
|
45
|
-
rubygems_version: 3.
|
45
|
+
rubygems_version: 3.3.7
|
46
46
|
signing_key:
|
47
47
|
specification_version: 4
|
48
48
|
summary: Turning your worst nightmare into a Ruby gem.
|