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

method_details/html/spec.erb is faulty due to .times not having a block. #1

Open
tlabeeuw opened this issue Feb 19, 2010 · 2 comments · May be fixed by #3
Open

method_details/html/spec.erb is faulty due to .times not having a block. #1

tlabeeuw opened this issue Feb 19, 2010 · 2 comments · May be fixed by #3

Comments

@tlabeeuw
Copy link

The 'templates_custom/default/method_details/html/specs.erb' spec causes an exception as .times expects a block. The line:

<%= spec[:source].split("\n").size.times.to_a.map {|i| spec[:line] + i }.join("\n") %>

should read:

<%= (0..(spec[:source].split("\n").size)).map { |i| _erbout << spec[:line] + i } %>

or alternatively:

<%= spec[:source].count("\n").times { |i| _erbout << spec[:line] + i } %>

Though count may not work if the last line does not end with "\n". The "_erbout" is ugly so a utility function like the capture method in rails could be used.

@lsegal
Copy link
Owner

lsegal commented Feb 19, 2010

What version is this? 1.8.6? #times should return an enumerator from 1.8.7 onwards.

@tlabeeuw
Copy link
Author

Indeed. This is on version 1.8.6. Sorry forgot to mention. A lot of people are still on this version.

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

Successfully merging a pull request may close this issue.

2 participants