Module: Borkalyzer

Extended by:
Borkalyzer
Included in:
Borkalyzer
Defined in:
lib/borkalyzer.rb

Defined Under Namespace

Modules: StringMethods

Constant Summary collapse

VERSION =
'1.0.1'
BEGINNING_REGEXP =
/^an|^a|^en|^e|^f|^o|^u|^the$|^bork$/.freeze
ENDING_REGEXP =
/tion$|a$|e$|ow$|ow$|o$|u$/.freeze

Instance Method Summary collapse

Instance Method Details

#bork(string) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/borkalyzer.rb', line 17

def bork(string)
  result = ''
  s = StringScanner.new(string)
  until s.eos? do
    word = s.scan(/\w+|\W+/)
    result << if( word =~ /^\W+$/ )
                tr_nonword word
              else
                tr_word word
              end
  end
  result
end

#monkey_patch(mod) ⇒ Object



32
33
34
# File 'lib/borkalyzer.rb', line 32

def monkey_patch(mod)
  mod.send :include, self.const_get(:StringMethods)
end