http://www.vimgolf.com/challenges/4d1a1c36567bac34a9000002
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
end
End file:
class Golfer
def self.hello(*a)
puts "Hello #{a.join(',')}"
end
end
So… yeah, missed a bit of it – coming up with final solution now.
j3Xd2Cd2gCdk<space>djf}t"Jc.join('.')<esc>,q
-
This one is painful!
I’ve got 43:
j3Xdmc(*a)<esc>ghdd<a-i>i<a-s><a-;>;d<space>kdfafdca.join(',')<esc>,q
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.