Module: Pry::DefaultCommands::ModuleIntrospectionHelpers
- Defined in:
- lib/pry/default_commands/introspection.rb
Overview
For show-doc and show-source
Instance Attribute Summary (collapse)
-
- (Object) module_object
Returns the value of attribute module_object.
Instance Method Summary (collapse)
- - (Boolean) method?
- - (Boolean) module?(name)
- - (Object) module_start_line(mod, candidate = 0)
- - (Object) process(name)
- - (Boolean) use_line_numbers?
Instance Attribute Details
- (Object) module_object
Returns the value of attribute module_object
8 9 10 |
# File 'lib/pry/default_commands/introspection.rb', line 8 def module_object @module_object end |
Instance Method Details
- (Boolean) method?
14 15 16 17 18 |
# File 'lib/pry/default_commands/introspection.rb', line 14 def method? !!method_object rescue CommandError false end |
- (Boolean) module?(name)
10 11 12 |
# File 'lib/pry/default_commands/introspection.rb', line 10 def module?(name) self.module_object = Pry::WrappedModule.from_str(name, target) end |
- (Object) module_start_line(mod, candidate = 0)
30 31 32 33 34 35 36 |
# File 'lib/pry/default_commands/introspection.rb', line 30 def module_start_line(mod, candidate=0) if opts.present?(:base-one') 1 else mod.source_line_for_candidate(candidate) end end |
- (Object) process(name)
20 21 22 23 24 25 26 27 28 |
# File 'lib/pry/default_commands/introspection.rb', line 20 def process(name) if module?(name) code_or_doc = process_module else method? code_or_doc = process_method end render_output(code_or_doc, opts) end |
- (Boolean) use_line_numbers?
38 39 40 |
# File 'lib/pry/default_commands/introspection.rb', line 38 def use_line_numbers? opts.present?(:b) || opts.present?(:l) end |