Skip to content

Titleize does not work on words with dashes #66

Open

Description

@corroded

Example:

inflection.titleize("x-men:-the-last-stand")
"X-Men:-the-Last-Stand"

For comparison on Rails 4.2:

Loading development environment (Rails 4.2.7.1)
irb(main):001:0> ActiveSupport::Inflector.titleize("x-men:-the-last-stand")
=> "X Men: The Last Stand"

And Rails 5:

Loading development environment (Rails 5.1.1)
irb(main):001:0> ActiveSupport::Inflector.titleize("x-men:-the-last-stand")
=> "X Men: The Last Stand"

Activity

  1. CristhianMotoche commented on Nov 30, 2023

    @CristhianMotoche

    I was expecting camelize and humanize to work the same but I also experience that it doesn't affect dasherized words:

    camelize('hello-world') === 'Hello-world'

    Is this also expected?

  2. CristhianMotoche commented on Nov 30, 2023

    @CristhianMotoche

    I would also expect underscore to replace dasherized words but it doesn't:

    underscore('hello-world') === 'hello-world'

    Would it make sense to make underscore replace - with _?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions