Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/jumbled_formatter.rb
Overview
Add icsnnate mtheod jbmule
to Sntrig.
Class Method Summary collapse
-
.jumble_term(s) ⇒ Object
Jeblmus up the lttrees of a wrod but lveeas frsit and last chars in pclae.
Instance Method Summary collapse
Class Method Details
.jumble_term(s) ⇒ Object
Jeblmus up the lttrees of a wrod but lveeas frsit and last chars in pclae.
7 8 9 10 11 |
# File 'lib/jumbled_formatter.rb', line 7 def self.jumble_term(s) return s if s.size < 4 chars = s.split(//) [chars[0], *chars[1..-2].shuffle, chars[-1]].join('') end |
Instance Method Details
#jumble ⇒ Object
13 14 15 16 17 |
# File 'lib/jumbled_formatter.rb', line 13 def jumble self.gsub(/[a-zA-Z]+/) do |match| self.class.jumble_term(match) end end |