def method_missing(method_name, *arguments, &block)
if method_name.to_s =~ /^ask_for_(.*)/
if arguments.count != 1
fail ArgumentError, "wrong number of arguments (given #{arguments.count}, expected 1)"
end
prompt = arguments.first
requested_class = Regexp.last_match[1]
available_classes = (Object.constants - DEPRECATED_CONSTANTS).map do |const|
Object.const_get(const)
end.select do |const|
const.class == Class && const.respond_to?(:parse)
end
klass = available_classes.find { |k| k.to_s.downcase == requested_class }
if klass
HighLine.default_instance.ask(prompt, klass)
else
super
end
else
super
end
end