Created
August 9, 2017 13:00
-
-
Save psachin/1228a361b307530d4466bbafce4feb0e to your computer and use it in GitHub Desktop.
CMFE/ManageQI rails console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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