Class: Gitlab::Sherlock::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/sherlock/location.rb

Constant Summary collapse

SHERLOCK_DIR =
File.dirname(__FILE__)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, line) ⇒ Location

path - The full path of the frame as a String. line - The line number of the frame as a Fixnum.


15
16
17
18
# File 'lib/gitlab/sherlock/location.rb', line 15

def initialize(path, line)
  @path = path
  @line = line
end

Instance Attribute Details

#lineObject (readonly)

Returns the value of attribute line


4
5
6
# File 'lib/gitlab/sherlock/location.rb', line 4

def line
  @line
end

#pathObject (readonly)

Returns the value of attribute path


4
5
6
# File 'lib/gitlab/sherlock/location.rb', line 4

def path
  @path
end

Class Method Details

.from_ruby_location(location) ⇒ Object

Creates a new Location from a `Thread::Backtrace::Location`.


9
10
11
# File 'lib/gitlab/sherlock/location.rb', line 9

def self.from_ruby_location(location)
  new(location.path, location.lineno)
end

Instance Method Details

#application?Boolean

Returns true if the current frame originated from the application.


21
22
23
# File 'lib/gitlab/sherlock/location.rb', line 21

def application?
  @path.start_with?(Rails.root.to_s) && !path.start_with?(SHERLOCK_DIR)
end