BeautifyRuby icon indicating copy to clipboard operation
BeautifyRuby copied to clipboard

keeps indenting if a json hash formatted keyword is used

Open NullVoxPopuli opened this issue 11 years ago • 1 comments

before_save   O.new("v"),
    if: Proc.new { |p| [154, 1217].include?(p.account_id) }
after_save    O.new("v"),
    if: Proc.new { |p| [154, 1217].include?(p.account_id) }
after_find    O.new("v"),
    if: Proc.new { |p| p.attributes.include?("v") && [154, 1217].include?(p.account_id) }

becomes:

before_save   O.new("v"),
if: Proc.new { |p| [154, 1217].include?(p.account_id) }
    after_save    O.new("v"),
    if: Proc.new { |p| [154, 1217].include?(p.account_id) }
        after_find    O.new("v"),
        if: Proc.new { |p| proposal.attributes.include?("v") && [154, 1217].include?(p.account_id) }

the top code block is correct.

I think it's seeing the "if" keywoard, and just auto-indenting the line without looking at what if is

a condition starting with if: isn't actually valid.

NullVoxPopuli avatar Feb 04 '14 16:02 NullVoxPopuli

:+1:

thoughtpunch avatar Apr 21 '15 23:04 thoughtpunch