Attribute query methods and semantics

This really comes down to ones own understanding of English. Since visible is a quality of some object one may reasonably infer that #visible? is synonymous with #is_visible? This might not actually be the case of course but the inference is strong.

In the case of #url? an url is not a quality, it is an object in own right even if its representation is wholly contained within the state of a container object (i.e. an attribute with a string value). I agree with the OP that in this case #url? is not good form and that #url is a superior since it imparts the idea that one should receive a representation and not simply a boolean.

However, #has_url? or #has_anything? to me would be pointless in Ruby. If an object has one then just tell it to provide it and if nil is returned then it does not.

One use that hasn't been mentioned previously - passing method names to things like :if, :unless etc in validations. With the ? version, this can be pretty short:

validates_presence_of :some_attribute, :unless => :some_other_attribute?

The no-? version doesn't do the right thing in many cases (since empty strings evaluate to true), and using present? instead requires a Proc.

Not certain if this is a sufficient argument for the existence of the ? suffix, but worth thinking about.

--Matt Jones