Class: Location
- Inherits:
-
Object
- Object
- Location
- Defined in:
- lib/debugtrace/location.rb
Overview
Contains source location information.
Instance Attribute Summary collapse
-
#lineno ⇒ Object
readonly
Returns the value of attribute lineno.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(caller_location) ⇒ Location
constructor
Initializes this object.
-
#to_s ⇒ String
Returns a string representation of this object.
Constructor Details
#initialize(caller_location) ⇒ Location
Initializes this object.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/debugtrace/location.rb', line 14 def initialize(caller_location) if caller_location == nil @name = 'unknown' @path = 'unknown' @lineno = 0 else @name = caller_location.label if @name.start_with?('Object#') @name = caller_location.base_label end @path = caller_location.path || 'unknown' @lineno = caller_location.lineno end end |
Instance Attribute Details
#lineno ⇒ Object (readonly)
Returns the value of attribute lineno.
9 10 11 |
# File 'lib/debugtrace/location.rb', line 9 def lineno @lineno end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/debugtrace/location.rb', line 7 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/debugtrace/location.rb', line 8 def path @path end |
Instance Method Details
#to_s ⇒ String
Returns a string representation of this object.
32 33 34 |
# File 'lib/debugtrace/location.rb', line 32 def to_s() return "(Location){name: #{@name}, path: #{@path}, lineno: #{@lineno}" end |