summaryrefslogtreecommitdiff
path: root/kernel.rb
diff options
context:
space:
mode:
Diffstat (limited to 'kernel.rb')
-rw-r--r--kernel.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/kernel.rb b/kernel.rb
index e7d955fe45..d00ba3a809 100644
--- a/kernel.rb
+++ b/kernel.rb
@@ -1,6 +1,27 @@
module Kernel
#
# call-seq:
+ # obj.class -> class
+ #
+ # Returns the class of <i>obj</i>. This method must always be called
+ # with an explicit receiver, as #class is also a reserved word in
+ # Ruby.
+ #
+ # 1.class #=> Integer
+ # self.class #=> Object
+ #--
+ # Equivalent to \c Object\#class in Ruby.
+ #
+ # Returns the class of \c obj, skipping singleton classes or module inclusions.
+ #++
+ #
+ def class
+ Primitive.attr! 'inline'
+ Primitive.cexpr! 'rb_obj_class(self)'
+ end
+
+ #
+ # call-seq:
# obj.clone(freeze: nil) -> an_object
#
# Produces a shallow copy of <i>obj</i>---the instance variables of