Skip to content

Commit

Permalink
Remove warning by defining the constant in the right place
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfranca committed Aug 2, 2023
1 parent 405d4af commit dc3df04
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/web_console/source_location.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# frozen_string_literal: true

class SourceLocation
def initialize(binding)
@binding = binding
end
module WebConsole
class SourceLocation
def initialize(binding)
@binding = binding
end

if RUBY_VERSION >= "2.6"
def path() @binding.source_location.first end
def lineno() @binding.source_location.last end
else
def path() @binding.eval("__FILE__") end
def lineno() @binding.eval("__LINE__") end
if RUBY_VERSION >= "2.6"
def path() @binding.source_location.first end
def lineno() @binding.source_location.last end
else
def path() @binding.eval("__FILE__") end
def lineno() @binding.eval("__LINE__") end
end
end
end

0 comments on commit dc3df04

Please sign in to comment.