Module: Shiritori::SearchMethod

Included in:
Main
Defined in:
lib/shiritori/search_method.rb

Constant Summary collapse

UNUSE_METHOD =
[:exit]

Instance Method Summary collapse

Instance Method Details

#get_all_methodObject



5
6
7
8
9
10
11
12
# File 'lib/shiritori/search_method.rb', line 5

def get_all_method
  @check_list = {}
  @method_list = []

  scan_method

  @method_list - UNUSE_METHOD
end

#scan_method(klass = BasicObject) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/shiritori/search_method.rb', line 14

def scan_method(klass = BasicObject)
  @check_list[klass] = true
  @method_list |= klass.instance_methods

  ObjectSpace.each_object(Class) do |subclass|
    scan_method(subclass) if klass != subclass && @check_list[subclass].nil?
  end
end