Skip to content

Instantly share code, notes, and snippets.

@itang
Created March 10, 2015 14:18
Show Gist options
  • Save itang/f2c178c1fa4ed928136d to your computer and use it in GitHub Desktop.
Save itang/f2c178c1fa4ed928136d to your computer and use it in GitHub Desktop.
2.2.0 :001 > class A
2.2.0 :002?> end
=> nil
2.2.0 :003 > class B < A
2.2.0 :004?> end
=> nil
2.2.0 :005 > a = A.new
=> #<A:0x0000000155df60>
2.2.0 :006 > b = B.new
=> #<B:0x00000001542670>
2.2.0 :007 > a.is_a? A
=> true
2.2.0 :008 > a.is_a? B
=> false
2.2.0 :009 > b.is_a? A
=> true
2.2.0 :010 >
2.2.0 :011 > b.is_a? B
=> true
2.2.0 :012 > b.instance_of? B
=> true
2.2.0 :013 > b.instance_of? A
=> false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment