How this will look in ruby?

sorry for asking conversion and not doing it myself(since I’ve little
to none knowledge of Ruby).
Can somebody translate this code snippent in Ruby?

sub formatfld {
my $f = shift;
join(’’, map(ucfirst, split(’_’, $f)));
}

thanks in advance.

On Tue, Aug 26, 2008 at 2:45 AM, adm [email protected] wrote:

sorry for asking conversion and not doing it myself(since I’ve little
to none knowledge of Ruby).
Can somebody translate this code snippent in Ruby?

sub formatfld {
my $f = shift;
join(‘’, map(ucfirst, split(‘_’, $f)));
}

def format(string)
string.split(/_/).map { |e| e.capitalize }.join
end