Class: IRB::Command::Copy
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
category, description, execute, help_message, #initialize
Constructor Details
This class inherits a constructor from IRB::Command::Base
Instance Method Details
permalink #execute(arg) ⇒ Object
[View source]
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/irb/command/copy.rb', line 23 def execute(arg) # Copy last value if no expression was supplied arg = '_' if arg.to_s.strip.empty? value = irb_context.workspace.binding.eval(arg) output = irb_context.inspect_method.inspect_value(value, +'', colorize: false).chomp if clipboard_available? copy_to_clipboard(output) else warn "System clipboard not found" end rescue StandardError => e warn "Error: #{e}" end |