Skip to content

Instantly share code, notes, and snippets.

@shepmaster
Created February 22, 2012 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shepmaster/1886730 to your computer and use it in GitHub Desktop.
Save shepmaster/1886730 to your computer and use it in GitHub Desktop.
Overriding #new
class A
def self.new(arg1, arg2)
B.new(arg2, arg1)
end
end
class B
def initialize(alpha, beta)
puts "#{alpha}, #{beta}"
end
end
a = A.new(1, 2)
# => 2, 1
puts a.class
# => B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment