singleton methods (for options checking maybe?)

# Did this out of interest, only to find out that
# the same functionality already exists in ruby ;-)
# Obviously, I'm redefining extend on Object,
# but it still does the expected thing.

class Object
  def extend(m)
    instance_eval do
      (class << self; self; end).send :include, m
    end
  end
end


Leave a Reply

Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>