Created
February 4, 2015 03:38
-
-
Save mulder/945c9058f6ce2606ab95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.new(t);t.class==Class ? t.new : t;end;def method_missing(*a);c=Kernel.const_get(a[0]) rescue(nil);c ? c.new(*a[1..-1]) : super; end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
attr_reader :bar | |
def initialize(bar) | |
@bar = bar | |
end | |
end | |
f = new Foo(1) | |
f.bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
copy the first bit into irb land; then run the second bit.