Skip to content

Instantly share code, notes, and snippets.

require 'eventmachine'
EM.run {
EM.defer {
p 'X'
100000000.times.reduce(:+)
p 'X'
}
class TestClass
def initialize
@test = rand
end
def const_missing(name)
return @test if name == :Test
super
end
end
class Deck < Array
def initialize(*cards)
if [ Array, Deck ].include? cards.first.class
super
else
super cards.map { |card|
Card.new card
}
end
end