# Better name for instance bypass method?

**URL:** <https://www.ruby-forum.com/t/better-name-for-instance-bypass-method/93497>\
**Category:** Ruby\
**Created:** [April 4, 2006, 12:20am UTC](https://www.ruby-forum.com/t/better-name-for-instance-bypass-method/93497 "2006-04-04T00:20:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/dfb087/32.png) [@Trans](https://www.ruby-forum.com/u/Trans)\
**Post date:** [April 4, 2006, 12:20am UTC](https://www.ruby-forum.com/t/better-name-for-instance-bypass-method/93497/1 "2006-04-04T00:20:17Z")

</div>

Ths is used inside an object that clears out most of the Kernel methods  
(like BlankSlate). It allows one to get at those methods.

class BasicObject

```
# ... undefines Kernel methods ...

class Instance < self
  define_method( :method_missing ) do |meth, *args| # &blk|
    Kernel.instance_method(meth).bind(self).call(*args) # ,&blk)
  end
end

def instance
  @ __instance__ ||= Instance.new
end

```

end

For example:

class A \< BasicObject  
end

a = A.new  
a.class #=\> NoMethodError  
a.instance.class #=\> A

I would be happy with the name “instance” except it does minorly  
conflict with Singleton (not the eigenclass kind). Anyone have a better  
suggestion for the name. Note, I originally choice “instance” because  
of other methods like #instance\_variables.

Thanks,  
T.

---

<div class="post-metadata">

**Author:** ![Trans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/dfb087/32.png) [@Trans](https://www.ruby-forum.com/u/Trans)\
**Post date:** [April 4, 2006, 2:40am UTC](https://www.ruby-forum.com/t/better-name-for-instance-bypass-method/93497/2 "2006-04-04T02:40:27Z")

</div>

Very nice, Ara. I will use this!

Thanks,  
T.

---

<div class="post-metadata">

**Author:** ![Trans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/dfb087/32.png) [@Trans](https://www.ruby-forum.com/u/Trans)\
**Post date:** [April 4, 2006, 12:54am UTC](https://www.ruby-forum.com/t/better-name-for-instance-bypass-method/93497/3 "2006-04-04T00:54:09Z")

</div>

On Tue, 4 Apr 2006, Trans wrote:

> ```
> end
> 
> ```
> 
> end
> 
> def instance  
> @ **instance** ||= Instance.new  
> end

maybe

class BasicObject

```
 Self = Class.new(self) do
   ...
   ...
   ...
 end

 def Self() @ __self__ ||= Self.new end

```

end

so

o = BasicObject.new  
o.Self.p 42

??

in fact, you can even

```
 def self() @ __self__ ||= Self.new end

```

though that might be confusing, maybe…

```
 def __self__ () @ __self__ ||= Self.new end

```

food for thought.

regards.

-a
