What's the verb form of id?


#1

Random question:

I’ve written a method for the String class that turns an arbitrary
line of text in to an identifier, e.g.:

“My, what a beautiful day!”
=> “my_what_a_beautiful_day”

“(anb*#NF(AMNV”
=> “anb_NF_AMNV”

We’ve got all these great names already like underscore, classify,
titleize and things like that. I’d like to name my new method
similarly. What would the verb form of id, or identifier, be?

idize
identifize
identitize

Maybe?

Duane J.
(canadaduane)
http://blog.inquirylabs.com/


#2

verify_identificality_of … haha… j/k of course. i vote for:
identifize
how are you using it ? would it be worth adding to Inflector maybe ?


#3

On Jan 27, 2006, at 5:36 PM, Dylan S. wrote:

verify_identificality_of … haha… j/k of course. i vote for:
identifize
how are you using it ? would it be worth adding to Inflector maybe ?

I’m using it in a helper method that takes the title of a
“section” (e.g., a

) and creates a javascript-friendly ‘id’ out
of it. For example:

<% section ‘Tell Us About Yourself’ do %>
… form goes here …
<% end %>

produces:

Tell Us About Yourself

... form goes here ...

It’s the first time I’ve had a need for this, but if it’s generally
useful, I could submit a patch…

Duane J.
(canadaduane)
http://blog.inquirylabs.com/


#4

Duane J. wrote:

Random question:

I’ve written a method for the String class that turns an arbitrary
line of text in to an identifier, e.g.:

“My, what a beautiful day!”
=> “my_what_a_beautiful_day”

How about :

“rubify” since you are basically making it a ruby-style indentifier

_Kevin


#5

Ah… I like “rubify.” I actually wrote a function that did just this a
couple days ago. I called it “variableize” though. “rubify” is much,
much
better!

Here’s the code, if anyone’s interested :slight_smile:

class Inflector
def self.rubify string
string.gsub(/\s/, ‘_’).downcase
end
end

Example:

Inflector::rubify “Rabbit Blue” # rabbit_blue

  • Rabbit


#6

permalink?

-Ezra
On Jan 27, 2006, at 4:36 PM, Dylan S. wrote:

I’ve written a method for the String class that turns an arbitrary
similarly. What would the verb form of id, or identifier, be?
http://blog.inquirylabs.com/
http://lists.rubyonrails.org/mailman/listinfo/rails
-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
removed_email_address@domain.invalid


#7

On Jan 27, 2006, at 5:59 PM, Rabbit wrote:

end

Example:

Inflector::rubify “Rabbit Blue” # rabbit_blue

  • Rabbit

I like the name too. Here’s the modified String class. This one
squeezes non-alphanumeric character sequences down to one underscore
and also makes sure it doesn’t start or end with an underscore:

class String
def rubify
downcase.gsub(/\W/, ’ ‘).squeeze.strip.gsub(’ ', ‘_’)
end

def rubify!
replace rubify
end
end

“!Hell93 o3#$@ the___re , dude”.rubify
=> “hel93_o3_the_re_dude”

Duane J.
(canadaduane)
http://blog.inquirylabs.com/


#8

On 1/27/06, Duane J. removed_email_address@domain.invalid wrote:

Duane J.
(canadaduane)
http://blog.inquirylabs.com/


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

In file_column, that method is called sanitize.


Kyle M.
Chief Technologist
E Factor Media // FN Interactive
removed_email_address@domain.invalid
1-866-263-3261


#9

ID is short for identification the related verb of which is identify, as
Alex pointed out.

The appropriate verify_ macro would be verify_identity_of

Looking at your original examples perhaps you don’t mean verb form but
you
mean what word should you use for the process of turning something into
its
identity form?

If thats the case, I’d avoid the mangling of the English language that
some
Rails methods take, and use the more conventional Ruby idiom, to_id()
(like
to_s, to_i etc.).

“My, what a beautiful day!”.to_id
=> “my_what_a_beautiful_day”

If thats not clear enough or possibly confusing with the normal use of
id in
a Rails app, perhaps to_identifier() instead.

Cheers
Luke


#10

Duane J. wrote:

We’ve got all these great names already like underscore, classify,
titleize and things like that. I’d like to name my new method
similarly. What would the verb form of id, or identifier, be?

identify, surely?


#11

Hey Duane J. I like your method better! :slight_smile: Thanks for sharing.

I gotta agree with Luke on the Rubyesque idiom, much cleaner. I shall
change
my code accordingly.

Good discussion. :slight_smile:

  • Rabbit


#12

+1 on Luke’s comment. I’m too lazy to think rationaly about the english
language like he did… but he made some good points :slight_smile:


#13

This would be nice to have in the Inflector Class in core. Adding this
as a
method of the String class probably wont make it into core if submitted.

Just something to think about.

How about sanctify ? It’s kinda like your cleansing it of its sins.

Bob S.

http://www.railtie.net/


From: removed_email_address@domain.invalid
[mailto:removed_email_address@domain.invalid] On Behalf Of Dylan S.
Sent: Saturday, January 28, 2006 3:13 PM
To: removed_email_address@domain.invalid
Subject: Re: [Rails] What’s the verb form of id?

+1 on Luke’s comment. I’m too lazy to think rationaly about the english
language like he did… but he made some good points :slight_smile:

On 1/28/06, Rabbit < removed_email_address@domain.invalid> wrote:

Hey Duane J. I like your method better! :slight_smile: Thanks for sharing.

I gotta agree with Luke on the Rubyesque idiom, much cleaner. I shall
change
my code accordingly.

Good discussion. :slight_smile:

  • Rabbit

On 1/28/06, Luke R. < removed_email_address@domain.invalid
mailto:removed_email_address@domain.invalid > wrote:

ID is short for identification the related verb of which is identify, as
Alex pointed out.

The appropriate verify_ macro would be verify_identity_of

Looking at your original examples perhaps you don’t mean verb form but
you
mean what word should you use for the process of turning something into
its
identity form?

If thats the case, I’d avoid the mangling of the English language that
some
Rails methods take, and use the more conventional Ruby idiom, to_id()
(like
to_s, to_i etc.).

“My, what a beautiful day!”.to_id
=> “my_what_a_beautiful_day”

If thats not clear enough or possibly confusing with the normal use of
id in
a Rails app, perhaps to_identifier() instead.

Cheers
Luke


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


#14

Bob S. wrote:

How about sanctify ? It’s kinda like your cleansing it of its sins.

Then maybe it should be ‘exorcise’. Hmm… I need more of that anyway.

_Kevin