Commit Graph

9 Commits

Author SHA1 Message Date
Jordon Bedwell adaddaa307 Ignore editor temp files AKA this-is_my-file.rb~ 2012-04-01 06:18:29 -05:00
Bram Swenson 99a98ef8a9 [#408] migrate play, cat, edit & cd commands to command_class 2012-01-15 18:05:17 +13:00
Ryan Fitzgerald ab6903ec27 update .gitignore 2011-11-04 23:22:28 -07:00
Conrad Irwin 139f94e83f gitignore *.gem 2011-10-09 14:04:42 -07:00
Yorick Peterse e9c2f383eb Pry now indents code similar to IRB.
Code is indented using the class Pry::Indent. This class uses an internal stack
that contains the indentation levels for each line of code. Certain keywords
such as "class" or "def" will add data to this stack so that the next line is
indented, other keywords such as "end" or "}" will remove data from the stack,
causing the next line to be un-indented.

Pry::Indent is hooked into Pry#retrieve_line as well as Pry#readline. This means
that both input strings as well as the ones displayed by "show-method" are
indented. Sadly due to the way Readline works input strings are indented similar
to IRB. This means that instead of the following:

    > class User
    >   def initialize
    >   end
    > end

You'll get the following:

    > class User
    >   def initialize
    >     end
    >   end

While annoying there doesn't seem to be a way to work around this issue. Luckily
the "show-method" command indents your code properly.

By default indentation is turned on. This can be turned off (or back on) using
the configuration item Pry.config.indent. However, if you turn this option off
after a method is defined "show-method" will still show it with indentation as
indentation happens on input rather than only when code is displayed.

For more information see Pry::Indent#indent in lib/pry/indent.rb.

Signed-off-by: Yorick Peterse <yorickpeterse@gmail.com>
2011-10-05 19:04:44 +02:00
Ryan Fitzgerald 7ece261723 implement command_prefix feature 2011-07-26 00:34:54 -07:00
Mon ouïe 450697008b Ignored Rubinius' output 2011-05-07 07:34:51 +02:00
John Mair 228b95f516 added new 'alias_command' and 'desc' commands to CommandBase; also made it so show_method comamnd without parameters does a show_method on __method__ 2011-01-26 23:13:46 +13:00
John Mair 70bc1222e2 changed get_prompt to select_prompt 2011-01-10 01:37:22 +13:00