Skip to content

Conversation

@jodosha
Copy link
Member

@jodosha jodosha commented Feb 20, 2015

What

Utils::String#titleize

How does it works?

require 'lotus/utils/string'

string = Lotus::Utils::String.new 'lotus utils'
string.titleize # => "Lotus Utils"

string = Lotus::Utils::String.new 'lotus-utils'
string.titleize # => "Lotus Utils"

string = Lotus::Utils::String.new 'LotusUtils'
string.titleize # => "Lotus Utils"

# etc..

Why?

This is a supporting feature for Lotus::Helpers' form helper.

<%=
  form_for(:book, routes.books_path) do
    label :extended_title
    # ...
  end
%>

That label accepts a symbol that should be titleized to become:

<label for="book-extended-title">Extended Title</label>

@jodosha jodosha self-assigned this Feb 20, 2015
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 98.83% when pulling 2bbd817 on string-titleize into ceed25d on master.

@runlevel5
Copy link

💯

jodosha added a commit that referenced this pull request Feb 21, 2015
Introduced Utils::String#titleize
@jodosha jodosha merged commit 4782e57 into master Feb 21, 2015
@jodosha jodosha deleted the string-titleize branch February 21, 2015 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants