Class: Object

Inherits:
BasicObject
Defined in:
lib/xiki/meths.rb

Overview

For:

my_instace.drill

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.meths(method = nil) ⇒ Object

# CodeTree.tree_search_option + result

end


29
30
31
# File 'lib/xiki/meths.rb', line 29

def self.meths method=nil
  Class.meths_internal self, method
end

.meths_internal(clazz, method = nil) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/xiki/meths.rb', line 37

def self.meths_internal clazz, method=nil
  # If no method, show all
  if method.nil?
    result = ""
    methods = clazz.instance_methods - Object.methods
    cmethods = clazz.methods - Class.methods
    return cmethods.sort.map{|o| ".#{o}"} + methods.sort.map{|o| "##{o}"}
  end

  # Method passed

  method.sub! /\/$/, ''
  if method =~ /\.(.+)/
    return "- " + clazz.method($1).source_location.join(':')
  end
  "- " + clazz.instance_method(method).source_location.join(':')

end

Instance Method Details

#meths(method = nil) ⇒ Object



33
34
35
# File 'lib/xiki/meths.rb', line 33

def meths method=nil
  Class.meths_internal self.class, method
end