This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'eventmachine' | |
EM.run { | |
EM.defer { | |
p 'X' | |
100000000.times.reduce(:+) | |
p 'X' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestClass | |
def initialize | |
@test = rand | |
end | |
def const_missing(name) | |
return @test if name == :Test | |
super | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Deck < Array | |
def initialize(*cards) | |
if [ Array, Deck ].include? cards.first.class | |
super | |
else | |
super cards.map { |card| | |
Card.new card | |
} | |
end | |
end |
NewerOlder