methods:
show the methods of this object
ex:
10.methods
dup:
make a copy of original object
ex:
“test”.dup
reverse:
ex:
"test".reverse
--->"tset"
match:
ex:
match:
“test”.match(“es”)
not match:
“test”.match(“ed”)
is_a?:
decide if the object is this type
ex:
"test".is_a?(String)
---> true
ancestors:
ex:
Integer.ancestors
-- [Integer, Precision, Numeric, Comparable, Object, Kernel]
inspect
return the string representation of object
ex:
[1,2,3].inspect
--> "[1,2,3]"
note: p [1,2,3] equals [1,2,3].inspect
superclass:
class method, tell the superclass of class
沒有留言:
張貼留言