Class: Logging::CallLocation

Inherits:
Object
  • Object
show all
Defined in:
lib/logging/call_location.rb

Overview

Proxy class to allow a custom ‘caller_location` to be used

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(function = nil, file = nil, line = nil) ⇒ CallLocation

create proxy caller_location

See Also:



11
12
13
14
15
# File 'lib/logging/call_location.rb', line 11

def initialize(function = nil, file = nil, line = nil)
  @base_label = function
  @path = file
  @lineno = line
end

Instance Attribute Details

#base_labelObject

Returns the value of attribute base_label.



6
7
8
# File 'lib/logging/call_location.rb', line 6

def base_label
  @base_label
end

#linenoObject

Returns the value of attribute lineno.



6
7
8
# File 'lib/logging/call_location.rb', line 6

def lineno
  @lineno
end

#pathObject

Returns the value of attribute path.



6
7
8
# File 'lib/logging/call_location.rb', line 6

def path
  @path
end

Class Method Details

.customize(call_location, function = nil, file = nil, line = nil) ⇒ Object

create proxy caller_location, default to standard values

Parameters:

  • call_location (Logging::CallLocation | Thread::Backtrace::Location)

    location to be logged as failure point

Returns:

  • Logging::CallLocation

See Also:



24
25
26
27
28
29
30
# File 'lib/logging/call_location.rb', line 24

def self.customize(call_location, function = nil, file = nil, line = nil)
  new(
    function || call_location.base_label,
    file || call_location.path,
    line || call_location.lineno
  )
end