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

TestUp::Console#puts changes Ruby console output of Arrays #210

Open
MSP-Greg opened this issue Aug 2, 2023 · 1 comment
Open

TestUp::Console#puts changes Ruby console output of Arrays #210

MSP-Greg opened this issue Aug 2, 2023 · 1 comment

Comments

@MSP-Greg
Copy link
Contributor

MSP-Greg commented Aug 2, 2023

The following code in main will change the console output of Arrays when loaded:

def puts(*args)
if args.empty?
write $/
else
for arg in args
line = arg.to_s
write(line)
if line.empty? || !line.end_with?($/)
write($/)
end
end
end
nil
end

Without it loaded, puts [1,2,3] shows the following in the console:

1
2
3

With it loaded, Array#to_s is used, so it outputs:

[1,2,3]
Eneroth3 added a commit that referenced this issue Aug 25, 2023
Without TestUp `puts [1,2,3]` outputs as:
```
1
2
3
```
Withy TestUp it outputs as `[1, 2, 3]'.

This fix restores the default Ruby behavior to puts for Arrays.
Eneroth3 added a commit that referenced this issue Aug 25, 2023
Without TestUp `puts [1,2,3]` outputs as:
```
1
2
3
```
Without TestUp it outputs as `[1, 2, 3]`.

This fix restores the default Ruby behavior to puts for Arrays.
@thomthom
Copy link
Member

This change was made to output similar to Ruby itself.

It's something I've been meaning to get into SketchUp itself when we do a refresh of the Ruby Console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants