class CarToCat::Base

Public Class Methods

catify(string) click to toggle source
# File lib/car_to_cat/base.rb, line 3
def self.catify(string)
  string.gsub(/(car)s?\b/i) do |match|
    match[/r/] ? match.sub(/r/, "t") : match.sub(/R/, "T")
  end
end
convert(input_file, output_file) click to toggle source
# File lib/car_to_cat/base.rb, line 9
def self.convert(input_file, output_file)
  contents = input_file.read
  output_file.write(catify(contents))
end