File: source_location.rb

package info (click to toggle)
ruby-web-console 4.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 632 kB
  • sloc: ruby: 1,496; javascript: 497; sh: 19; makefile: 4
file content (17 lines) | stat: -rw-r--r-- 391 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

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
    end
  end
end