Skip to content
This repository has been archived by the owner on Sep 2, 2019. It is now read-only.

Commit

Permalink
Add support for continuing lines ending in equals
Browse files Browse the repository at this point in the history
  • Loading branch information
mocoso committed Jul 13, 2009
1 parent d2cc2f1 commit 34a7858
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Support/lib/rbeautify/config/ruby.rb
Expand Up @@ -102,8 +102,8 @@
:nest_except => [:double_quote, :single_quote, :regex, :back_tick])

ruby.add_matcher(:continuing_line,
/(,|\.|\+|-|=\>|&&|\|\||\\|==|\s\?|:)(\s*)?(#.*)?$/,
/(^|(,|\.|\+|-|=\>|&&|\|\||\\|==|\s\?|:)(\s*)?)(#.*)?$/,
/(,|\.|\+|-|=\>|=|&&|\|\||\\|==|\s\?|:)(\s*)?(#.*)?$/,
/(^|(,|\.|\+|-|=\>|=|&&|\|\||\\|==|\s\?|:)(\s*)?)(#.*)?$/,
:indent_end_line => true,
:negate_ends_match => true,
:nest_except => [:continuing_line, :curly_bracket, :round_bracket, :square_bracket])
Expand Down
16 changes: 15 additions & 1 deletion Support/spec/fixtures/ruby.yml
Expand Up @@ -287,4 +287,18 @@
output: |
foo = bar.collect { |paragraph|
paragraph.strip
}.join("\n")
}.join("\n")
- name: indent continuing lines ending in = and +
input: |
def foo
@bar ||=
1 +
2
end
output: |
def foo
@bar ||=
1 +
2
end

0 comments on commit 34a7858

Please sign in to comment.