Franklin Chen's grain of sand

Infinity in the palm of my hand

Happy Programmers' Day!

Permalink

Happy Programmers' Day!

I only by accident found out that today was Programmers' Day. It is apparently observed the 256th day of each year. This is my first year of “observing” the day.

Since the day is almost over, I hurriedly came up with this little piece of code. Guess what it does?

Mystery Rubylink
require_relative 'utils'
class Mystery
attr_reader :mysterious
end

The trick, of course, lies in what we have in utils.rb:

Utilitieslink
class Class
alias orig_attr_reader attr_reader
def attr_reader(*args)
args.each do |arg|
if arg == :mysterious
puts "Happy Programmers' Day!"
end
end
orig_attr_reader(*args)
end
end

Very simple, nothing fancy, but perverse enough for a bit of Programmers' Day fun.

Comments