| Class | Pry::CodeObject |
| In: |
lib/pry/code_object.rb
|
| Parent: | Object |
This class is responsible for taking a string (identifying a command/class/method/etc) and returning the relevant type of object. For example, if the user looks up "show-source" then a `Pry::Command` will be returned. Alternatively, if the user passes in "Pry#repl" then a `Pry::Method` object will be returned.
The `CodeObject.lookup` method is responsible for 1. figuring out what kind of object the user wants (applying precedence rules in doing so — i.e methods get precedence over commands with the same name) and 2. Returning the appropriate object. If the user fails to provide a string identifer for the object (i.e they pass in `nil` or "") then the object looked up will be the ‘current method’ or ‘current class’ associated with the Binding.
TODO: This class is a clusterfuck. We need a much more robust concept of what a "Code Object" really is. Currently commands/classes/candidates/methods and so on just share a very ill-defined interface.
| _pry_ | [RW] | |
| str | [RW] | |
| super_level | [RW] | |
| target | [RW] |
when no paramter is given (i.e CodeObject.lookup(nil)), then we lookup the ‘current object’ from the binding.