Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve pp output for ActiveHash::Relation #288

Merged
merged 1 commit into from
Aug 11, 2023

Conversation

flavorjones
Copy link
Collaborator

Previously the output might look like:

#<ActiveHash::Relation:0x00007f4c2dc3ca28
 @all_records=
  [#<Layout:0x00007f4c2df4f198 @attributes={:id=>1, :name=>"1"}>,
   #<Layout:0x00007f4c2df4cfd8 @attributes={:id=>2, :name=>"2"}>,
   #<Layout:0x00007f4c2df4b9a8 @attributes={:id=>3, :name=>"3"}>,
   #<Layout:0x00007f4c2df7d9f8 @attributes={:id=>4, :name=>"4"}>],
 @conditions=#<ActiveHash::Relation::Conditions:0x00007f4c2dc3bd58 @conditions=[]>,
 @klass=Layout,
 @order_values=[]>

After this change the output looks like:

[#<Layout:0x00007f2755785d60 @attributes={:id=>1, :name=>"1"}>,
 #<Layout:0x00007f2755784668 @attributes={:id=>2, :name=>"2"}>,
 #<Layout:0x00007f2755783a38 @attributes={:id=>3, :name=>"3"}>,
 #<Layout:0x00007f2755782db8 @attributes={:id=>4, :name=>"4"}>]

Closes #285

Previously the output might look like:

    #<ActiveHash::Relation:0x00007f4c2dc3ca28
     @all_records=
      [#<Layout:0x00007f4c2df4f198 @attributes={:id=>1, :name=>"1"}>,
       #<Layout:0x00007f4c2df4cfd8 @attributes={:id=>2, :name=>"2"}>,
       #<Layout:0x00007f4c2df4b9a8 @attributes={:id=>3, :name=>"3"}>,
       #<Layout:0x00007f4c2df7d9f8 @attributes={:id=>4, :name=>"4"}>],
     @conditions=#<ActiveHash::Relation::Conditions:0x00007f4c2dc3bd58 @conditions=[]>,
     @klass=Layout,
     @order_values=[]>

After this change the output looks like:

    [#<Layout:0x00007f2755785d60 @attributes={:id=>1, :name=>"1"}>,
     #<Layout:0x00007f2755784668 @attributes={:id=>2, :name=>"2"}>,
     #<Layout:0x00007f2755783a38 @attributes={:id=>3, :name=>"3"}>,
     #<Layout:0x00007f2755782db8 @attributes={:id=>4, :name=>"4"}>]

Closes #285
Copy link
Collaborator

@kbrock kbrock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for running with this.

@kbrock kbrock added the feature label Aug 11, 2023
@kbrock kbrock self-assigned this Aug 11, 2023
@kbrock kbrock merged commit 57092b4 into master Aug 11, 2023
10 checks passed
@kbrock kbrock deleted the 285-pretty-print-relations branch August 11, 2023 23:22
@flavorjones flavorjones mentioned this pull request Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants