Rails’ ruby script/console has tab completion!
Posted by solipsistic on 12 Oct 2007 at 06:48 pm | Tagged as: rails, ruby
While I recently found out about Ruby’s ‘methods’ method, I also found that Rails’ “ruby script/console” will do tab completion:
>> a = Array.new => [] >> a. Display all 157 possibilities? (y or n) a.fetch a.method a.slice a.__id__ a.fill a.methods a.slice! a.__send__ a.find a.min a.sort a.all? a.find_all a.nil? a.sort! a.any? a.first a.nitems a.sort_by a.assoc a.flatten a.object_id a.split a.at a.flatten! a.pack a.subclasses_of a.b64encode a.freeze a.partition a.sum a.blank? a.frozen? a.pop a.suppress a.class a.gem a.pretty_inspect a.taguri a.clear a.grep a.pretty_print a.taguri= a.clone a.group_by a.pretty_print_cycle a.taint a.collect a.hash a.pretty_print_inspect a.tainted? a.collect! a.id a.pretty_print_instance_variables a.to_a a.compact a.in_groups_of a.private_methods a.to_ary a.compact! a.include? a.protected_methods a.to_default_s a.concat a.index a.public_methods a.to_formatted_s a.copy_instance_variables_from a.index_by a.push a.to_json a.daemonize a.indexes a.rassoc a.to_param a.dclone a.indices a.reject a.to_s a.decode64 a.inject a.reject! a.to_sentence a.decode_b a.insert a.remove_subclasses_of a.to_set a.delete a.inspect a.replace a.to_xml a.delete_at a.instance_eval a.require a.to_yaml a.delete_if a.instance_exec a.require_gem a.to_yaml_properties a.detect a.instance_of? a.require_library_or_gem a.to_yaml_style a.display a.instance_values a.respond_to? a.transpose a.dup a.instance_variable_get a.returning a.type a.each a.instance_variable_set a.reverse a.uniq a.each_index a.instance_variables a.reverse! a.uniq! a.each_with_index a.is_a? a.reverse_each a.unloadable a.empty? a.join a.rindex a.unshift a.enable_warnings a.kind_of? a.select a.untaint a.encode64 a.last a.send a.values_at a.entries a.length a.shift a.with_options a.eql? a.load a.silence_stderr a.yaml_initialize a.equal? a.map a.silence_stream a.zip a.extend a.map! a.silence_warnings a.extend_with_included_modules_from a.max a.singleton_methods a.extended_by a.member? a.size
Unfortunately the same thing doesn’t work for the irb. Of course you can always
a.methods.sort
to see the same information.