string_wizard 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 +4 -4
- data/lib/{string_enhancer → string_wizard}/core_ext.rb +35 -35
- data/lib/{string_enhancer → string_wizard}/encryption.rb +1 -1
- data/lib/{string_enhancer → string_wizard}/pattern_matcher.rb +1 -1
- data/lib/{string_enhancer → string_wizard}/transformer.rb +2 -2
- data/lib/{string_enhancer → string_wizard}/validator.rb +1 -1
- data/lib/string_wizard/version.rb +1 -1
- metadata +9 -9
- data/lib/string_enhancer/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1f0ec9132a345c89478c3d5bf8813b5e4ef2171c1c26cdb0dc1469130a6caaa
|
4
|
+
data.tar.gz: d576bf4d76910b65537b259167015904ab222f3e5961fa34e6676b33f3c006d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec4f9fa8ac899397f5d11d7dc309fab1993935fd59b4b14251f31167c633135e8abfc8d4bde27be14d4397e6eb154c5d9a06881c5427c8e4d1ef8d0e9d6b29e0
|
7
|
+
data.tar.gz: 405b8744d26d4d157fbcddf47bf8fb056759d904c2674e7c14d6fe557dcffc9bd3d61ab338ad4ce2109577b35bc8b51f78e5e18c6d0cbf3bad9edac9330c7c16
|
@@ -1,156 +1,156 @@
|
|
1
1
|
class String
|
2
2
|
# Returns a string with the first letter of each word capitalized
|
3
3
|
def titleize
|
4
|
-
|
4
|
+
StringWizard.titleize(self)
|
5
5
|
end
|
6
6
|
|
7
7
|
# Returns a string with all vowels removed
|
8
8
|
def remove_vowels
|
9
|
-
|
9
|
+
StringWizard.remove_vowels(self)
|
10
10
|
end
|
11
11
|
|
12
12
|
# Returns a string with all consonants removed
|
13
13
|
def remove_consonants
|
14
|
-
|
14
|
+
StringWizard.remove_consonants(self)
|
15
15
|
end
|
16
16
|
|
17
17
|
# Returns true if the string is a palindrome
|
18
18
|
def palindrome?
|
19
|
-
|
19
|
+
StringWizard.palindrome?(self)
|
20
20
|
end
|
21
21
|
|
22
22
|
# Returns a string with alternating case
|
23
23
|
def alternating_case
|
24
|
-
|
24
|
+
StringWizard.alternating_case(self)
|
25
25
|
end
|
26
26
|
|
27
27
|
# Returns a string with words in reverse order
|
28
28
|
def reverse_words
|
29
|
-
|
29
|
+
StringWizard.reverse_words(self)
|
30
30
|
end
|
31
31
|
|
32
32
|
# Advanced string analysis
|
33
33
|
def analyze
|
34
|
-
|
34
|
+
StringWizard.analyze(self)
|
35
35
|
end
|
36
36
|
|
37
37
|
# Pattern matching
|
38
38
|
def match_pattern(pattern)
|
39
|
-
|
39
|
+
StringWizard.match_pattern(self, pattern)
|
40
40
|
end
|
41
41
|
|
42
42
|
def matches_pattern?(pattern_name)
|
43
|
-
|
43
|
+
StringWizard::PatternMatcher.match_pattern(self, pattern_name)
|
44
44
|
end
|
45
45
|
|
46
46
|
def extract_patterns
|
47
|
-
|
47
|
+
StringWizard::PatternMatcher.extract_patterns(self)
|
48
48
|
end
|
49
49
|
|
50
50
|
def validate_format(pattern_name)
|
51
|
-
|
51
|
+
StringWizard::PatternMatcher.validate_format(self, pattern_name)
|
52
52
|
end
|
53
53
|
|
54
54
|
def sanitize(pattern_name)
|
55
|
-
|
55
|
+
StringWizard::PatternMatcher.sanitize(self, pattern_name)
|
56
56
|
end
|
57
57
|
|
58
58
|
# String transformation chain
|
59
59
|
def transform
|
60
|
-
|
60
|
+
StringWizard::Transformer.transform(self)
|
61
61
|
end
|
62
62
|
|
63
63
|
# String similarity
|
64
64
|
def similarity(other)
|
65
|
-
|
65
|
+
StringWizard.similarity(self, other)
|
66
66
|
end
|
67
67
|
|
68
68
|
# Parallel processing
|
69
69
|
def self.process_batch(strings, batch_size: 100, &block)
|
70
|
-
|
70
|
+
StringWizard.process_batch(strings, batch_size: batch_size, &block)
|
71
71
|
end
|
72
72
|
|
73
73
|
def self.analyze_batch(strings, batch_size: 100)
|
74
|
-
|
74
|
+
StringWizard.analyze_batch(strings, batch_size: batch_size)
|
75
75
|
end
|
76
76
|
|
77
77
|
def self.transform_batch(strings, transformations, batch_size: 100)
|
78
|
-
|
78
|
+
StringWizard.transform_batch(strings, transformations, batch_size: batch_size)
|
79
79
|
end
|
80
80
|
|
81
81
|
def self.similarity_matrix(strings, batch_size: 100)
|
82
|
-
|
82
|
+
StringWizard.similarity_matrix(strings, batch_size: batch_size)
|
83
83
|
end
|
84
84
|
|
85
85
|
# Encryption
|
86
86
|
def encrypt(key, algorithm: 'AES-256-CBC')
|
87
|
-
|
87
|
+
StringWizard.encrypt(self, key, algorithm: algorithm)
|
88
88
|
end
|
89
89
|
|
90
90
|
def self.decrypt(encrypted_str, key, algorithm: 'AES-256-CBC')
|
91
|
-
|
91
|
+
StringWizard.decrypt(encrypted_str, key, algorithm: algorithm)
|
92
92
|
end
|
93
93
|
|
94
94
|
def hash(algorithm: :sha256)
|
95
|
-
|
95
|
+
StringWizard.hash(self, algorithm: algorithm)
|
96
96
|
end
|
97
97
|
|
98
98
|
def secure_compare(other)
|
99
|
-
|
99
|
+
StringWizard.secure_compare(self, other)
|
100
100
|
end
|
101
101
|
|
102
102
|
# Fuzzy matching
|
103
103
|
def fuzzy_match(candidates, threshold: 0.8)
|
104
|
-
|
104
|
+
StringWizard.fuzzy_match(self, candidates, threshold: threshold)
|
105
105
|
end
|
106
106
|
|
107
107
|
def best_match(candidates, threshold: 0.8)
|
108
|
-
|
108
|
+
StringWizard.best_match(self, candidates, threshold: threshold)
|
109
109
|
end
|
110
110
|
|
111
111
|
# Validation methods
|
112
112
|
def valid_email?
|
113
|
-
|
113
|
+
StringWizard.valid_email?(self)
|
114
114
|
end
|
115
115
|
|
116
116
|
def valid_url?
|
117
|
-
|
117
|
+
StringWizard.valid_url?(self)
|
118
118
|
end
|
119
119
|
|
120
120
|
def valid_phone?
|
121
|
-
|
121
|
+
StringWizard.valid_phone?(self)
|
122
122
|
end
|
123
123
|
|
124
124
|
def valid_date?(format: '%Y-%m-%d')
|
125
|
-
|
125
|
+
StringWizard.valid_date?(self, format: format)
|
126
126
|
end
|
127
127
|
|
128
128
|
def valid_time?
|
129
|
-
|
129
|
+
StringWizard.valid_time?(self)
|
130
130
|
end
|
131
131
|
|
132
132
|
def valid_ip?
|
133
|
-
|
133
|
+
StringWizard.valid_ip?(self)
|
134
134
|
end
|
135
135
|
|
136
136
|
def valid_credit_card?
|
137
|
-
|
137
|
+
StringWizard.valid_credit_card?(self)
|
138
138
|
end
|
139
139
|
|
140
140
|
def valid_hex_color?
|
141
|
-
|
141
|
+
StringWizard.valid_hex_color?(self)
|
142
142
|
end
|
143
143
|
|
144
144
|
def valid_json?
|
145
|
-
|
145
|
+
StringWizard.valid_json?(self)
|
146
146
|
end
|
147
147
|
|
148
148
|
def valid_xml?
|
149
|
-
|
149
|
+
StringWizard.valid_xml?(self)
|
150
150
|
end
|
151
151
|
|
152
152
|
# Clear memoization cache
|
153
153
|
def self.clear_cache
|
154
|
-
|
154
|
+
StringWizard.clear_cache
|
155
155
|
end
|
156
156
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module StringWizard
|
2
2
|
module Transformer
|
3
3
|
class Chain
|
4
4
|
def initialize(str)
|
@@ -62,7 +62,7 @@ module StringEnhancer
|
|
62
62
|
if transformation.is_a?(Proc)
|
63
63
|
result = transformation.call(result)
|
64
64
|
else
|
65
|
-
result =
|
65
|
+
result = StringWizard.transform(result, transformation)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
result
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: string_wizard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hassan Tahir
|
@@ -102,18 +102,18 @@ executables: []
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
-
- lib/string_enhancer/core_ext.rb
|
106
|
-
- lib/string_enhancer/encryption.rb
|
107
|
-
- lib/string_enhancer/pattern_matcher.rb
|
108
|
-
- lib/string_enhancer/transformer.rb
|
109
|
-
- lib/string_enhancer/validator.rb
|
110
|
-
- lib/string_enhancer/version.rb
|
111
105
|
- lib/string_wizard.rb
|
106
|
+
- lib/string_wizard/core_ext.rb
|
107
|
+
- lib/string_wizard/encryption.rb
|
108
|
+
- lib/string_wizard/pattern_matcher.rb
|
109
|
+
- lib/string_wizard/transformer.rb
|
110
|
+
- lib/string_wizard/validator.rb
|
112
111
|
- lib/string_wizard/version.rb
|
113
|
-
homepage: https://
|
112
|
+
homepage: https://rubygems.org/gems/string_wizard
|
114
113
|
licenses:
|
115
114
|
- MIT
|
116
|
-
metadata:
|
115
|
+
metadata:
|
116
|
+
source_code_uri: https://github.com/hassantahir176/string-wizard
|
117
117
|
post_install_message:
|
118
118
|
rdoc_options: []
|
119
119
|
require_paths:
|