From: Intransition Date: 2012-05-22T23:51:24+09:00 Subject: Opinion on String#camelcase ------=_Part_118_1914384.1337698281491 Content-Type: multipart/alternative; boundary="----=_Part_119_25825730.1337698281491" ------=_Part_119_25825730.1337698281491 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Recently I adjusted Ruby Facets String#camelcase method to leave the first character of the string alone. Previously it would upcase the first character by default. I never could decide is downcase or upcase should the default, so that's why I ultimately settled on doing neither and leaving it to the end-developer to handle. To which end I also added #uppercase and #lowercase methods to alter just the first character. So one can do: "foo_man".camelcase #=> 'fooMan" "foo_man".uppercase.camelcase #=> 'FooMan" "Foo_man".lowercase.camelcase #=> 'fooMan" Of course, there is still the optional argument too: "foo_man".camelcase(:upper) #=> 'FooMan" "Foo_man".camelcase(:lower) #=> 'fooMan" Does this approach make sense to others? I know the change probably pissed off a few people, as they had to go back and fix some lines of code. But I think the new approach is for the better. Yet, just to be sure I want to solicit opinions. Do you agree with this change, or do you think defaulting to either upper or lower case was really the proper approach? I know I should have done this earlier, but better late then never. ------=_Part_119_25825730.1337698281491 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Recently I adjusted Ruby Facets String#camelcase method to leave the first = character of the string alone. Previously it would upcase the first charact= er by default. I never could decide is downcase or upcase should the defaul= t, so that's why I ultimately settled on doing neither and leaving it to th= e end-developer to handle. To which end I also added #uppercase and #lowerc= ase methods to alter just the first character. So one can do:

  "foo_man".camelcase             =      #=3D> 'fooMan"
  "foo_man".upperc= ase.camelcase  #=3D> 'FooMan"
  "Foo_man".lower= case.camelcase  #=3D> 'fooMan"

Of cour= se, there is still the optional argument too:

  "foo_man".= camelcase(:upper)  #=3D> 'FooMan"
  "Foo_man".camelcase(:lower)  #= =3D> 'fooMan"

Does this approac= h make sense to others?

I know the change pr= obably pissed off a few people, as they had to go back and fix some lines o= f code. But I think the new approach is for the better. Yet, just to be sur= e I want to solicit opinions. Do you agree with this change, or do you= think defaulting to either upper or lower case was really the proper appro= ach?

I know I should have done this earlier, but b= etter late then never.

------=_Part_119_25825730.1337698281491-- ------=_Part_118_1914384.1337698281491--