Ian Bicking: the old part of his blog

Re: Fixes whats wrong with python comment 000

they just write:

def an_instance.amethod(args)
 ...
end

It is a nice way to write stuff since it also allows for clear specification of class/module methods:

class Foo
 # we are in Foo's scope, "self" is Foo
 def foo() puts "I'm an instance method" end
 def self.foo() puts "I'm a singleton method of a Class instance" end
 def self.bar() puts "In java parlance, I'm a static method of class Foo" end
end

(Formatting fixed; I'm not actually the author of this comment)

Comment on Fixes whats wrong with python comment 000
by Ian Bicking

Comments:

There's also this:

module Mod
  def hello
    "Hello from Mod.\n"
  end
end
class Klass
  def hello
    "Hello from Klass.\n"
  end
end
k = Klass.new
k.hello       ->      "Hello from Klass.\n"
k.extend(Mod)         ->      #<Klass:0x4018d554>
k.hello       ->      "Hello from Mod.\n"
# Alexander Staubo