On Sat, Feb 23, 2013 at 11:49 AM, Love U Ruby <[email protected]> wrote:
> Is the below statement holds true in the course of instantiation
> relations ?
>
> (a) BasicObject is an instance of Class (as well as (kind) of Module,
> Object, BasicObject).
>
> (b) Object is an instance of Class (as well as (kind) of Module, Object,
> BasicObject).
>
> --
> Posted via http://www.ruby-forum.com/.
>

Hi 'Love U Ruby'.

There is a method that seems all you need in this case:

= .instance_of?

(from ruby core)
=== Implementation from Object
------------------------------------------------------------------------------
  obj.instance_of?(class)    -> true or false

------------------------------------------------------------------------------

Returns true if obj is an instance of the given class. See also
Object#kind_of?.

  class A;     end
  class B < A; end
  class C < B; end

  b = B.new
  b.instance_of? A   #=> false
  b.instance_of? B   #=> true
  b.instance_of? C   #=> false


http://ruby-doc.org/core-1.9.3/Object.html#method-i-instance_of-3F
Hope this helps.
Yup!

e.

-- 
[email protected] | 
https://groups.google.com/d/forum/ruby-talk-google?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"ruby-talk-google" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to