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

Special variable like $` causes mess #47

Open
hongliang-goudou opened this issue Jul 17, 2013 · 0 comments
Open

Special variable like $` causes mess #47

hongliang-goudou opened this issue Jul 17, 2013 · 0 comments

Comments

@hongliang-goudou
Copy link
Contributor

class A
  def foo
    "abc" =~ /\w+/
    puts $`
  end

  def bar
  end
end

After BeautifyRuby runs, it turns out to be:

class A
  def foo
    "abc" =~ /\w+/
    puts $`
  end

  def bar
      end    #### <---- wrong!
end

A temporary workaround is:

class A
  def foo
    "abc" =~ /\w+/
    puts $` #`    <------ workaround!
  end

  def bar
  end
end

Some other special ruby variables, such as $', $, $+, etc, would cause more serious problem than $`. They are not easy to workaround. So we need special treatment for these special variables.

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