module Feels::Bad::Man

Constants

VERSION

Public Class Methods

good_cocktail(directory) click to toggle source
# File lib/feels/bad/man.rb, line 6
def self.good_cocktail(directory)
  raise ArgumentError, "directory plz" if File.file?(directory)
  Dir.glob("#{File.expand_path(ARGV.first)}/**/*.rb").each do |file|
    fucked_up = []
    File.open(file).each_line.map do |line|
      fucked_up << line.sub(/\s*/) do |match|
        Array.new(5).map do
          case rand(2)
          when 0
            "\t" * rand(2)
          when 1
            " " * rand(3)
          end
        end.join
      end
    end

    File.open(file, "w").puts(fucked_up.join)
  end
end