-
Notifications
You must be signed in to change notification settings - Fork 72
Force output to a pager
Benjamin Thomas edited this page Jan 8, 2017
·
1 revision
- Export this env var, from ~/.bashrc for example.
PAGER="less -S"
- Put those methods in ~/.irbrc or ~/.pryrc
def page(active_record_object)
formatted_output = Hirb::View.formatter.format_output(active_record_object, options: { resize: false })
inspect_mode = false
Hirb::View.pager.page(formatted_output, inspect_mode)
end
def vpage(active_record_object)
formatted_output = Hirb::View.formatter.format_output(active_record_object, options: { vertical: true })
inspect_mode = false
Hirb::View.pager.page(formatted_output, inspect_mode)
end
- Use as such, from the rails console
page BlogPost.all
vpage BlogPost.all