Ruby logoRuby/
RB-ST1045

Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtracesRB-ST1045

Minor severityMinor
Anti-pattern categoryAnti-pattern

eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. It is recommended to pass the metadata to eval method.

Bad practice

eval <<-RUBY
  def do_something
  end
RUBY

C.class_eval <<-RUBY
  def do_something
  end
RUBY
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY