Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/masososo/core_ext.rb
Instance Method Summary collapse
-
#similar_chars(options = {}) ⇒ Object
Returns similar chars.
-
#typo(options = {}) ⇒ Object
(also: #masososo)
Return the string replaced similar-looking chars randomly.
Instance Method Details
#similar_chars(options = {}) ⇒ Object
Returns similar chars.
'ソ'.similar_chars
# => ["リ", "ン"]
'ソ'.similar_chars(including_self: true)
# => ["ソ", "リ", "ン"]
28 29 30 |
# File 'lib/masososo/core_ext.rb', line 28 def similar_chars( = {}) Masososo.similar_chars(self, ) end |
#typo(options = {}) ⇒ Object Also known as: masososo
Return the string replaced similar-looking chars randomly.
'リリリリリリリリリン'.typo
# => "ソリンッリリリッンソ"
Setting frequency: 0 disables typo. Default value is 0.5.
'リリリリリリリリリン'.typo(frequency: 0)
# => "リリリリリリリリリン"
'リリリリリリリリリン'.typo(frequency: 1.0)
# => "ソソンッソソソッンリ"
16 17 18 |
# File 'lib/masososo/core_ext.rb', line 16 def typo( = {}) Masososo.similar_string(self, ) end |