如何看一个ruby对象所拥有的方法


array = []
puts array.methods.sort

输出如下
&
*
+
-
<<
<=>
==
===
=~
[]
[]=
__id__
__send__
all?
any?
assoc
at
choice
class
clear
clone
collect
collect!
combination
compact
compact!
concat
count
cycle
delete
delete_at
delete_if
detect
display
drop
drop_while
dup
each
each_cons
each_index
each_slice
each_with_index
empty?
entries
enum_cons
enum_for
enum_slice
enum_with_index
eql?
equal?
extend
fetch
fill
find
find_all
find_index
first
flatten
flatten!
freeze
frozen?
grep
group_by
hash
id
include?
index
indexes
indices
inject
insert
inspect
instance_eval
instance_exec
instance_of?
instance_variable_defined?
instance_variable_get
instance_variable_set
instance_variables
is_a?
join
kind_of?
last
length
map
map!
max
max_by
member?
method
methods
min
min_by
minmax
minmax_by
nil?
nitems
none?
object_id
one?
pack
partition
permutation
pop
private_methods
product
protected_methods
public_methods
push
rassoc
reduce
reject
reject!
replace
respond_to?
reverse
reverse!
reverse_each
rindex
select
send
shift
shuffle
shuffle!
singleton_methods
size
slice
slice!
sort
sort!
sort_by
taint
tainted?
take
take_while
tap
to_a
to_ary
to_enum
to_s
transpose
type
uniq
uniq!
unshift
untaint
values_at
zip
|
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值