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_method ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/shiritori/search_method.rb', line 5 def get_all_method @check_list = Hash.new(false) @method_list = [] scan_method @method_list - UNUSE_METHOD end |
#scan_method(klass = BasicObject) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/shiritori/search_method.rb', line 18 def scan_method(klass = BasicObject) @check_list[klass] = true @method_list |= klass.instance_methods ObjectSpace.each_object(singleton(klass)) do |subclass| if klass != subclass scan_method(subclass) unless @check_list[subclass] end end end |
#singleton(klass) ⇒ Object
14 15 16 |
# File 'lib/shiritori/search_method.rb', line 14 def singleton(klass) class << klass; self end end |