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

poem.lines doesn't work #172

Open
ashes999 opened this issue Sep 14, 2014 · 1 comment
Open

poem.lines doesn't work #172

ashes999 opened this issue Sep 14, 2014 · 1 comment

Comments

@ashes999
Copy link

In section two, I see:

Okay, sure. So the whole poem's been turned backwards, letter-by-letter. I really want to just reverse the lines, though. Move the last line up to first and the first line down to last. Backwards, but not that backwards.

Here's how: poem.lines.to_a.reverse

poem.lines gives me an error. This is odd, because the rdoc for 1.9.3 shows lines as a valid method.

This seems very odd.

@calebegg
Copy link

The problem seems to be that .lines returns an Enumerator, and tryruby doesn't want to print the string version of (any) enumerators. (maybe they are getting detected as errors). If you do poem.lines.to_a, as suggested, you get the lines. You can do poem.lines.to_s to see what it should be printing.

So I think the fix is to print enumerators normally, instead of giving:

=> Something's gone wrong- that might not have been valid ruby

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