Skip to content

Instantly share code, notes, and snippets.

@abyx
Created October 18, 2011 05:52
Show Gist options
  • Save abyx/1294707 to your computer and use it in GitHub Desktop.
Save abyx/1294707 to your computer and use it in GitHub Desktop.
Object.const_defined? :Integer
#=> true
class Integer
#...
end
def Integer(value)
#...
end
Object.private_method_defined? :Integer
#=> true
class MyClass:
def __init__(self, value):
self.value = value
my_class = MyClass(1) # We are calling the class to get
# an instance, instead of
# MyClass.new(1) in Ruby
Integer.class
#=> Class
Integer(1)
#=> 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment