1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
Commit graph

17 commits

Author SHA1 Message Date
John Mair
c95c25e4d8 Allow show-source --super
Fixing this just required refactoring Pry::CodeObject#empty_lookup
so it respected the 'super_level' parameter
2013-05-18 02:23:01 +02:00
Kyrylo Silin
7a6a6164fe CodeObject: special case super keyword
Fix issue #917 (`$ super` should work (so should `$ -s`))

This is applies to both `show-source` and `show-doc`.
2013-05-04 00:33:38 +03:00
Kyrylo Silin
3546a3acd5 Show{Source,Doc}: assume super definitions from the context
Fix issue #877 (show-source -s doesn't work (when no method arg is
given))

This behaviour is shared between `show-source` and `show-doc`. So with
one fix I kill two bugs.

Add tests and rewrite some of the existing ones (related to the
`--super` switch).
2013-03-27 23:47:32 +02:00
John Mair
342648f61f show-source: Indicate all monkeypatches can be shown with -a
Fixes #849
2013-03-12 20:52:10 +02:00
John Mair
8f4b11d70d Fix failing tests on rbx
The failures were due to Rbx recovering more source than expected (compared to MRI)

For example, the following fails in MRI:
module M
end

module N
  include M
end

show-source N

but on rbx it succeeds and shows the source of N

How does rbx do it? It appears to create a secret method called __module_init__ on a module whenever you include another module.
This method has its source_location set to the `include` line.
2013-02-08 03:11:42 +01:00
John Mair
4ca59800f2 Make show-source/show-doc fall-back to superclass
When performing show-source/show-doc on a class whose code
cannot be extracted we now fall-back to its first accessible superclass
and show its code together with a warning.

Example:

class Model < ActiveRecord::Base
end

show-source Model #=> shows ActiveRecord::Base code
2013-02-07 15:57:46 +01:00
John Mair
b7e70db004 show-source/show-doc: Show the first module candidate with source/docs
Prior to this change `show-source ActiveRecord::Base` would fail, as the highest ranked
candidate couldn't be discovered.
2013-01-29 15:25:05 +01:00
John Mair
4afb8d34a1 show-source: support create_command based commands 2013-01-29 15:25:05 +01:00
Kyrylo Silin
256f35422a Prettify command descriptions, switches and stuff
Wrap command descriptions to 80 characters. Convert some string options
to symbols (where possible). Align options in code. Remove dots in the
end of switch descriptions.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2013-01-09 22:23:19 +02:00
Ryan Fitzgerald
b5455a10bc Fix Regexp warnings on 1.8.7 2012-12-27 17:34:25 -08:00
John Mair
37b9fce976 show-source / show-doc: ensure _file_ and _line_ are set
Also cleaned up some OCD edge cases for show-doc, totally unnecessary & kind of silly
2012-12-22 22:59:03 +01:00
John Mair
eda2c73afb make show-source code more readable 2012-12-20 20:46:33 +01:00
John Mair
47d30a139c free show-source from the horror of module_introspection_helpers.rb and method_options.rb
show-doc and edit and a variety of other commands can also be updated to use the new Pry::CodeObject API
2012-12-20 20:15:00 +01:00
John Mair
81554dda0a migrating show-source over to new Pry::CodeObject API 2012-12-20 18:05:42 +01:00
John Mair
9a279461c1 PryTestHelpers methods are now module_functions, included into Bacon::Context by default 2012-12-07 23:08:49 +01:00
John Mair
31a9578228 cleaned up lib/pry/test/helper.rb
* removed most historicla junk from lib/pry/test/helper.rb
* relocated recalcitrant junk to the local spec/helper.rb (this isn't exposed to 3rd parties)
2012-12-07 21:41:05 +01:00
☈king
848b6bdbeb Rename for tabcompletion-friendliness. 2012-11-15 18:59:51 -06:00
Renamed from test/test_commands/test_show_source.rb (Browse further)