February 2012
2 posts
Array#uniq in Ruby 1.8.7
On github: https://gist.github.com/1905081
class Equal
attr_accessor :name
def initialize(name)
@name = name
end
def inspect
@name
end
def hash
puts "#{name}: hash"
super
end
def eql?(co)
puts "#{name}: eql? against #{co.name}"
super
end
def ==(co)
puts "#{name}: == against #{co.name}"
super
end
end
EqualA = Equal.new('EqualA')
EqualB =...
Autoloading in Rails 3
Rails 3 by default adds these to the autoload paths:
app/*
vendor/plugins/*/lib
vendor/plugins/*/app/*
In addition, gems, when they are defined as Rails engines/railties, get each directory in app added to the autoload path.
Notable exceptions: Rails does not automatically add its own lib directory or the lib directories of any plugins to the load path.