Method for locating yourself in space and in time
Today I had a nice and productive day, code-wise. Maybe that's a side effect from being unable to lose my time following E-mail?
Anyway, checking my code with git citool previous to today's git commit, I came accross this method. I didn't even pay attention to it while writing. But it did make me laugh in semi-awe thinking about the great implications it might have. The method signature:
def days_for(who, what, how)
The code itself? Naah, too pedestrian, to simplistic. It will ruin the sight. It just looks so beautifully universal!
Ok, I am compelled to share, even if it spoils it and renders it into a completely regular, even stupid method.
def days_for(who, what, how) return ' —No dates set— ' unless who.has_validity_period? days_to = who.send(how) return 'Past' if days_to = 0 '%d days (%s)' % [days_to, who.send(what)] end
- Bitácora de gwolf
- Log in or register to post comments