On Jul 5, 6:25=A0am, Brian Candler <b.cand... / pobox.com> wrote:
> Thomas Sawyer wrote:
> > =A0 =A0 Library: foo-bar
> > =A0 =A0 Directory: lib/foo/bar
> > =A0 =A0 Namespace: Foo::Bar
>
> > =A0 =A0 Library: foo_bar
> > =A0 =A0 Directory: lib/foo_bar
> > =A0 =A0 Namespace: FooBar
>
> > That being the case I think Ruby needs to include methods to make it
> > easy to translate between these. In ActiveSupport these methods are
> > String#pathize and String#methodize. I would think there would also be
> > something like String#modulize.
>
> Perhaps you're thinking of camelize and underscore in
> lib/active_support/inflector.rb

Oh? My bad, I thought it had #pathize  and #methodize too.

> =A0 =A0 # Examples:
> =A0 =A0 # =A0 "active_record".camelize =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0# =
=3D> "ActiveRecord"
> =A0 =A0 # =A0 "active_record".camelize(:lower) =A0 =A0 =A0 =A0# =3D> "act=
iveRecord"
> =A0 =A0 # =A0 "active_record/errors".camelize =A0 =A0 =A0 =A0 # =3D>
> "ActiveRecord::Errors"
> =A0 =A0 # =A0 "active_record/errors".camelize(:lower) # =3D>
> "activeRecord::Errors"
>
> =A0 =A0 # Examples:
> =A0 =A0 # =A0 "ActiveRecord".underscore =A0 =A0 =A0 =A0 # =3D> "active_re=
cord"
> =A0 =A0 # =A0 "ActiveRecord::Errors".underscore # =3D> active_record/erro=
rs
>
> Each of these methods is only a few lines. I've seen them copy-pasted in
> several projects...

In Facets those are #camelcase and #snakecase, but it also has the
other methods -- No problem getting access to such methods. Just think
Ruby needs to support something along these lines out the box if the
correspondence should be considered a standard.