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

beautifyRuby smashes here_docs #36

Open
bwl21 opened this issue Apr 27, 2013 · 0 comments
Open

beautifyRuby smashes here_docs #36

bwl21 opened this issue Apr 27, 2013 · 0 comments

Comments

@bwl21
Copy link

bwl21 commented Apr 27, 2013

As a pity, BeautifyRuby does not leave here_docs untouched. This makes BeautifyRuby hard to use in this case.

Example:

module FOO
def foo
  config =<<-eos
### This file is  authorization file for #{@project_name}.
# do not remove * = at [/]

[groups]
observer=
developer=#{@project_admin_user}

[/]
@observer=r
@developer=rw
* = 
eos
end
end```

converts to

```ruby
module FOO
  def foo
    config =<<-eos
    ### This file is  authorization file for #{@project_name}.
    # do not remove * = at [/]

    [groups]
    observer=
      developer=#{@project_admin_user}

    [/]
@observer=r
@developer=rw
* = 
eos
end
end

or this example

template = %{
  <html>
    <head><title>Ruby Toys -- <%= @name %></title></head>
    <body>

      <h1><%= @name %> (<%= @code %>)</h1>
      <p><%= @desc %></p>

      <ul>
        <% @features.each do |f| %>
          <li><b><%= f %></b></li>
        <% end %>
      </ul>

      <p>
        <% if @cost < 10 %>
          <b>Only <%= @cost %>!!!</b>
        <% else %>
           Call for a price, today!
        <% end %>
      </p>

    </body>
  </html>
}.gsub(/^  /, '')

is converted to

template = %{
  <html>
  <head><title>Ruby Toys -- <%= @name %></title></head>
  <body>

  <h1><%= @name %> (<%= @code %>)</h1>
  <p><%= @desc %></p>

  <ul>
  <% @features.each do |f| %>
    <li><b><%= f %></b></li>
  <% end %>
  </ul>

  <p>
  <% if @cost < 10 %>
  <b>Only <%= @cost %>!!!</b>
  <% else %>
  Call for a price, today!
  <% end %>
  </p>

  </body>
  </html>
}.gsub(/^  /, '')
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

1 participant