You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is actually a feature request that shouldn't be hard to implement.
What I actually would like to have, is a depth of "awesome printing", so when for example I have an array like:
arr = [
[1,2,3],
[4,5,6],
[7,8,9]
]
then for depth == 2 it would print it the usual way, which would be ap arr, but if the depth == 1 then it would be displayed like in the above manner.
Reason for this feature? Pluck command. Let's take an ActiveRecord and do something like this ap User.where(...).pluck(:id, :created_at, :updated_at)
It would be printed in an ugly way, which would be something alike
[
[ 0] [
[0] 6,
[1] Fri, 22 Jun 2018 10:31:53 UTC +00:00,
[2] Fri, 22 Jun 2018 10:31:53 UTC +00:00
],
[ 1] [
[0] 7,
[1] Tue, 26 Jun 2018 09:00:50 UTC +00:00,
[2] Tue, 26 Jun 2018 09:00:50 UTC +00:00
],
[ 2] [
[0] 8,
[1] Tue, 26 Jun 2018 09:01:09 UTC +00:00,
[2] Tue, 26 Jun 2018 09:01:09 UTC +00:00
],
[ 3] [
[0] 10,
[1] Wed, 27 Jun 2018 07:28:20 UTC +00:00,
[2] Wed, 27 Jun 2018 07:28:20 UTC +00:00
]
]
when instead I would like it to show each record as a row, so that would look something like this
[
[ 0] [6, Fri, 22 Jun 2018 10:31:53 UTC +00:00, Fri, 22 Jun 2018 10:31:53 UTC +00:00],
[ 1] [7, Tue, 26 Jun 2018 09:00:50 UTC +00:00, Tue, 26 Jun 2018 09:00:50 UTC +00:00],
[ 2] [8, Tue, 26 Jun 2018 09:01:09 UTC +00:00, Tue, 26 Jun 2018 09:01:09 UTC +00:00],
[ 3] [10, Wed, 27 Jun 2018 07:28:20 UTC +00:00, Wed, 27 Jun 2018 07:28:20 UTC +00:00]
]
The text was updated successfully, but these errors were encountered:
maciejpk
changed the title
'depth' in options
[Feature] 'depth' in options
Jul 12, 2018
Doesn't support depth, and if you want to start printing out complex objects it will wrap and look very ugly, but for a quick hack it does the trick pretty well.
This is actually a feature request that shouldn't be hard to implement.
What I actually would like to have, is a depth of "awesome printing", so when for example I have an array like:
then for
depth == 2
it would print it the usual way, which would beap arr
, but if thedepth == 1
then it would be displayed like in the above manner.Reason for this feature? Pluck command. Let's take an
ActiveRecord
and do something like thisap User.where(...).pluck(:id, :created_at, :updated_at)
It would be printed in an ugly way, which would be something alike
when instead I would like it to show each record as a row, so that would look something like this
The text was updated successfully, but these errors were encountered: