Does anyone else finds attribute query methods semantically confusing?
Consider this code:
post = Post.new(:visible => true, :url => “http://com”)
puts “ima visible!”
puts “ima url! (wait wat? o_0)”
Does this feel right to you? In case with post.url? i read it as “Hey post object, are you an url?” which is apparently not what the code will do.
So it seems like semantically perfect flag checks go together with totally confusing(for a reader) way of checking whether an attribute is present or not.
I would generate attribute query methods only for boolean attributes.