Class: Thread::Backtrace::Location

Inherits:
Object
  • Object
show all
Defined in:
opal/stdlib/thread.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ Location

Returns a new instance of Location.



115
116
117
118
119
120
121
122
123
124
125
# File 'opal/stdlib/thread.rb', line 115

def initialize(str)
  @str = str

  str =~ /^(.*?):(\d+):(\d+):in `(.*?)'$/
  @path = Regexp.last_match(1)
  @label = Regexp.last_match(4)
  @lineno = Regexp.last_match(2).to_i

  @label =~ /(\w+)$/
  @base_label = Regexp.last_match(1) || @label
end

Instance Attribute Details

#base_labelObject (readonly)

Returns the value of attribute base_label.



135
136
137
# File 'opal/stdlib/thread.rb', line 135

def base_label
  @base_label
end

#labelObject (readonly)

Returns the value of attribute label.



135
136
137
# File 'opal/stdlib/thread.rb', line 135

def label
  @label
end

#linenoObject (readonly)

Returns the value of attribute lineno.



135
136
137
# File 'opal/stdlib/thread.rb', line 135

def lineno
  @lineno
end

#pathObject (readonly) Also known as: absolute_path

Returns the value of attribute path.



135
136
137
# File 'opal/stdlib/thread.rb', line 135

def path
  @path
end

Instance Method Details

#inspectObject



131
132
133
# File 'opal/stdlib/thread.rb', line 131

def inspect
  @str.inspect
end

#to_sObject



127
128
129
# File 'opal/stdlib/thread.rb', line 127

def to_s
  @str
end