Skip to content

Add String::dasherize  #9411

Open
Open
@wout

Description

For example:

"underscored_string".dashserize
# => "underscored-string"

I find myself needing this in macros and in runtime code in various situations throughout multiple projects. It works great in conjunction with underscore:

"LovelyClassName".underscore.dasherize
# => "lovely-class-name"

Doing string.dasherize instead of string.gsub(/_/, "-") is a lot more fun.

I wouldn't mind creating a PR for this.

Activity

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions