Skip to content

Instantly share code, notes, and snippets.

@psachin
Created August 9, 2017 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psachin/1228a361b307530d4466bbafce4feb0e to your computer and use it in GitHub Desktop.
Save psachin/1228a361b307530d4466bbafce4feb0e to your computer and use it in GitHub Desktop.
CMFE/ManageQI rails console
# limit output size in IRB console.
class IRB::Context
attr_accessor :max_output_size
alias initialize_before_max_output_size initialize
def initialize(*args)
initialize_before_max_output_size(*args)
@max_output_size = IRB.conf[:MAX_OUTPUT_SIZE] || 300
end
end
class IRB::Irb
def output_value
text =
if @context.inspect?
sprintf @context.return_format, @context.last_value.inspect
else
sprintf @context.return_format, @context.last_value
end
max = @context.max_output_size
if text.size < max
puts text
else
puts text[0..max-1] + "..." + text[-2..-1]
end
end
end
# Retrieve a new EVM object and set it to the $evm attribute.
def get_evm
MiqAeMethodService::MiqAeService.new(MiqAeEngine::MiqAeWorkspaceRuntime.new)
end
$evm = get_evm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment