Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v1_9_1_378) is shown here.
get_class_method_choice(method_map)
public
Given a Hash mapping a class’ methods to method
types (returned by display_class_method_list),
this method allows the user to choose one of the methods.
Show source
def get_class_method_choice(method_map)
if CAN_USE_READLINE
abbreviations = method_map.keys.abbrev
Readline.completion_proc = proc do |string|
abbreviations.values.uniq.grep(/^#{string}/)
end
end
@formatter.raw_print_line "\nEnter the method name you want.\n"
@formatter.raw_print_line "Class methods can be preceeded by '::' and instance methods by '#'.\n"
if CAN_USE_READLINE
@formatter.raw_print_line "You can use tab to autocomplete.\n"
@formatter.raw_print_line "Enter a blank line to exit.\n"
choice_string = Readline.readline(">> ").strip
else
@formatter.raw_print_line "Enter a blank line to exit.\n"
@formatter.raw_print_line ">> "
choice_string = $stdin.gets.strip
end
if choice_string == ''
return nil
else
class_or_instance = method_map[choice_string]
if class_or_instance
if(choice_string =~ /^[a-zA-Z]/)
if(class_or_instance == :class)
choice_string = "::#{choice_string}"
else
choice_string = "##{choice_string}"
end
end
return choice_string
else
@formatter.raw_print_line "No method matched '#{choice_string}'.\n"
return nil
end
end
end