Skip to content
New issue

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

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

Already on GitHub? # to your account

Heredoc constants do not preserve their indentation #1315

Closed
AaronC81 opened this issue Mar 12, 2020 · 0 comments · Fixed by #1495
Closed

Heredoc constants do not preserve their indentation #1315

AaronC81 opened this issue Mar 12, 2020 · 0 comments · Fixed by #1495

Comments

@AaronC81
Copy link

Heredocs are sensitive to their indentation, but it seems that YARD strips away this indentation.

Steps to reproduce

Create this file and generate documentation for it:

module X
  A = <<-EOF
    bar!
    EOF

  B = <<-EOF
  bar!
  EOF
end

Actual Output

irb> require 'yard'
=> true
irb> YARD::Registry.load!
=> YARD::Registry
irb> YARD::Registry.root.children.first.children.map(&:value)
=> ["<<-EOF\nbar!\nEOF", "<<-EOF\nbar!\nEOF"]

Expected Output

The values of the constants should be "<<-EOF\n bar!\n EOF" and <<-EOF\n bar!\n EOF" respectively, to reflect the values which Ruby assigns to them.

Environment details:

  • OS: Manjaro Linux 19.0.2 Kyria
  • Ruby version (ruby -v): ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
  • YARD version (yard -v): yard 0.9.24

I have read the Contributing Guide.

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

Successfully merging a pull request may close this issue.

1 participant