Method: Object#methods
- Defined in:
- lib/source/ruby.rb
#methods ⇒ Object
call-seq:
obj.methods -> array
Returns a list of the names of methods publicly accessible in obj. This will include all the methods accessible in obj’s ancestors.
class Klass
def k_method
end
end
k = Klass.new
k.methods[0..3] #=> ["k_method", "nil?", "is_a?", "class"]
k.methods.length #=> 42
625 626 627 628 629 |
# File 'lib/source/ruby.rb', line 625 def methods `var result=[],sub={_eql2:'==',_eql3:'===',_etld:'=~',_brac:'[]',_breq:'[]=',_lteq:'<=',_gteq:'>=',_ltlt:'<<',_gtgt:'>>',_lthn:'<',_gthn:'>',_ltgt:'<=>',_pipe:'|',_ampe:'&',_plus:'+',_posi:'+@',_nega:'-@',_star:'*',_str2:'**',_slsh:'/',_perc:'%',_care:'^',_tild:'~'}` `for(var x in this){if(x.slice(0,2)=='m$'&&x!='m$initialize'){var str=x.slice(2,x.length);str=sub[str]||str;result.push($q(str.replace('_bool','?').replace('_bang','!').replace('_eql','=')));};}` return `result` end |