Golf Day 3: Reformat/Refactor a Golfer Class

Reformat/Refactor a Golfer Class

A simple case of removing unneeded code and fixing broken indentation.

Start file:

class Golfer
     def initialize; end # initialize
  def useless; end;
     def self.hello(a,b,c,d)
      puts "Hello #{a}, #{b}, #{c}, #{d}"

End file:

class Golfer
  def self.hello(*a)
    puts "Hello #{a.join(',')}"

So… yeah, missed a bit of it – coming up with final solution now.


This one is painful!

I’ve got 43:


Yeah, I mean, it feels like we should be able to do a lot better than 34 – but it just falls apart in practice.

OK, I’m down to 35 (vs. Vim 32): j3XddCdCdm<space>t"c.join(',')}<esc>k<a-i>bc*a<esc>,q. Don’t think it’s done, we might make it.

@robertmeta it looks like you missed the hello parameters.

doh. I did!