Class: IRB::Command::Workspaces
Do not use. This class is for internal use only.
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
|
Subclasses:
|
|
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Base
|
|
|
Instance Chain:
self,
Base
|
|
| Inherits: |
IRB::Command::Base
|
| Defined in: | lib/irb/command/pushws.rb |
Class Method Summary
Base - Inherited
| .category, .description, | |
| .doc_dialog_content | Returns formatted lines for display in the doc dialog popup. |
| .execute, .help_message, .new, .highlight, .wrap_lines | |
Instance Attribute Summary
Base - Inherited
Instance Method Summary
Constructor Details
This class inherits a constructor from IRB::Command::Base
Instance Method Details
#execute(_arg)
[ GitHub ]# File 'lib/irb/command/pushws.rb', line 17
def execute(_arg) inspection_results = irb_context.instance_variable_get(:@workspace_stack).map do |ws| truncated_inspect(ws.main) end puts "[" + inspection_results.join(", ") + "]" end
#truncated_inspect(obj) (private)
[ GitHub ]# File 'lib/irb/command/pushws.rb', line 27
def truncated_inspect(obj) threshold = 20 obj_inspection = obj.inspect if obj_inspection.size > threshold closing = obj_inspection[-1] # Support closing characters for objects like: # #<Object...>, [array...], {hash...}, (123/456...), "string...", /regexp.../ # Other objects will be truncated without a closing character. closing = nil unless '>]})"/'.include?(closing) obj_inspection = "#{obj_inspection[...threshold - 1]}...#{closing}" end obj_inspection end