{"id":8,"date":"2007-05-12T11:32:47","date_gmt":"2007-05-12T15:32:47","guid":{"rendered":"http:\/\/hoolihan.net\/blog-tim\/?p=8"},"modified":"2010-04-09T11:54:13","modified_gmt":"2010-04-09T16:54:13","slug":"debugging-method-for-rubyclass-object","status":"publish","type":"post","link":"http:\/\/hoolihan.net\/blog-tim\/2007\/05\/12\/debugging-method-for-rubyclass-object\/","title":{"rendered":"Debugging Method For Rubyclass Object"},"content":{"rendered":"<pre>\r\n<code>class Object\r\n    def additional_methods\r\n        if self.instance_of?(Class)\r\n            self.methods.sort - Class.methods\r\n        else\r\n            self.methods.sort - Object.methods\r\n        end\r\n    end\r\nend\r\n\r\n#example usage\r\nclass Foo\r\n    def self.a\r\n    end\r\n    def Foo.b\r\n    end\r\n    def c\r\n    end\r\n    def d\r\n    end\r\nend\r\n\r\n{:class=&gt;Foo,:instance=&gt;Foo.new}.each do |name,obj|\r\n    puts \"#{name} additional methods: #{obj.additional_methods.join(',')}\"\r\nend<\/code>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>class Object def additional_methods if self.instance_of?(Class) self.methods.sort &#8211; Class.methods else self.methods.sort &#8211; Object.methods end end end #example usage class Foo def self.a end def Foo.b end def c end def d end end {:class=&gt;Foo,:instance=&gt;Foo.new}.each do |name,obj| puts &#8220;#{name} additional methods: #{obj.additional_methods.join(&#8216;,&#8217;)}&#8221; end<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-8","post","type-post","status-publish","format-standard","hentry","category-ruby"],"_links":{"self":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/posts\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/comments?post=8"}],"version-history":[{"count":0,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/posts\/8\/revisions"}],"wp:attachment":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/media?parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/categories?post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/tags?post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}