Class: TypoGen::StartSameSound
- Inherits:
-
Object
- Object
- TypoGen::StartSameSound
- Defined in:
- lib/typogen/start_same_sound.rb
Constant Summary collapse
- PATTERN_LIST =
[ %w(in im), %w(con com), %w(clo cro), %w(cou coa), %w(car cur), ].freeze
Class Method Summary collapse
Class Method Details
.create(word) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/typogen/start_same_sound.rb', line 11 def self.create(word) typo_list = [] PATTERN_LIST.each do |pattern| pattern.combination(2).each do |from, to| if word =~ /^#{from}/ typo_list << word.sub(/^#{from}/, to) elsif word =~ /^#{to}/ typo_list << word.sub(/^#{to}/, from) end end end typo_list end |