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
Stop putting "require 'rubygems'" in your project files. Just madly require | |
away, assuming that whatever you need will be found in the load path. | |
Install dollarspots.rb early in your loadpath. It checks the pwd for a file | |
named .dollarspots.rb and loads it if found. Use .dollarspots.rb files locally | |
in projects to jigger with your loadpath such that your reckless requires | |
actually work. Note that this may involve saying "require 'rubygems'". | |
Call ruby with -rdollarspots, or set "rdollarspots" as your RUBYOPT. | |
To get TextMate's RubyMate facilities to work you'll need to edit the RUBYOPT |
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
# "local" methods are those defined directly on a constant, | |
# as opposed to those inherited or mixed in | |
class Module | |
def local_class_methods | |
self.methods.select { |m| self.method(m).owner == self } | |
end | |
def local_instance_methods | |
self.instance_methods.select { |m| self.instance_method(m).owner == self } |
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
# first we will give Domains a little help | |
class Domain < String | |
def subdomain( rank = 1 ) ; self.split('.')[0..(rank-1)].join('.') ; end | |
def level( rank ) ; self.split('.')[(rank*-1)..-1].join('.') ; end | |
def top_level ; level(1) ; end | |
end | |
# now we can treat them like strings but also access domain components naturally | |
NewerOlder