The calendar is gone.
Click here to view posts


Ruby class mixin
Some times in ruby you want your mixin to be a class method. Search the google for ruby class mixin returned little help on the matter. Although, if you have never did a mixin before I suggest reading the pick axe book. This example should look familiar if you have read the book

#!/usr/bin/env ruby
module Debug
	def new_method()
		new()
	end
	
end
class Phonograph
	class << self
		include Debug
	end
end

class EightTrack
	class << self
		include Debug
	end
end

puts  Phonograph.new_method
puts  EightTrack.new_method


Currently I can not think of a good example of when this would be used, but it can be done. I understand why this works, but I think there would be a better way to achieve this.