Skip to content

Instantly share code, notes, and snippets.

@kinncj
Created January 16, 2015 15:56
Show Gist options
  • Save kinncj/6dfd280248b53e4cb2da to your computer and use it in GitHub Desktop.
Save kinncj/6dfd280248b53e4cb2da to your computer and use it in GitHub Desktop.
wtf? construct return different type
class ConcreteKlass
def self.new()
return []
end
end
obj = ConcreteKlass.new
print obj.inspect #WHY? WHYYY? Hey, let's instantiate new ConcreteKlass, now, it's an array? WTF!
@renatomefi
Copy link

class ConcreteKlass
    def self.new()
        return self
    end
end

obj = ConcreteKlass.new

print obj.inspect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment