BeautifyRuby icon indicating copy to clipboard operation
BeautifyRuby copied to clipboard

beautifyRuby smashes here_docs

Open bwl21 opened this issue 12 years ago • 0 comments

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(/^  /, '')

bwl21 avatar Apr 27 '13 12:04 bwl21