Skip to content

Instantly share code, notes, and snippets.

@zxiest
Created December 15, 2011 21:15
Show Gist options
  • Save zxiest/1482920 to your computer and use it in GitHub Desktop.
Save zxiest/1482920 to your computer and use it in GitHub Desktop.
truncate rails console output
module IRB
class Irb
MAX_LEN = 10000
def output_value
if (@context.inspect_last_value.length > MAX_LEN)
printf @context.return_format, "#{@context.inspect_last_value[0..MAX_LEN]} <- Truncated"
else
printf @context.return_format, @context.inspect_last_value
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment