DHH escreveu: > I can see the use case, but I strongly dislike the use of the > predicate to get there. nonblank is a nasty method name too. I don't > think nonzero? is a great example of API design for us to follow. This > hinges on getting a stellar name that really sums it up and makes it > immediately apparent what's going on. > > We just tried running through 20 candidates in the chat room and > didn't come up with anything worthwhile. We need something that's a > single word, like "present?" or "blank?" but doesn't use a predicate > and is exceptionally clear about what's going on. How about 'when_present' ?
Like: object.when_present || another_object It is not a single word, but it is expressive. 'or' would be great but there is a problem: object.or another_object The problem is that another_object would be evaluated always... object.or || another_object # also does not look great... What do you think? Best regards, Rodrigo. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
