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.



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

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.



137
138
139
# File 'opal/stdlib/thread.rb', line 137

def base_label
  @base_label
end

#labelObject (readonly)

Returns the value of attribute label.



137
138
139
# File 'opal/stdlib/thread.rb', line 137

def label
  @label
end

#linenoObject (readonly)

Returns the value of attribute lineno.



137
138
139
# File 'opal/stdlib/thread.rb', line 137

def lineno
  @lineno
end

#pathObject (readonly) Also known as: absolute_path

Returns the value of attribute path.



137
138
139
# File 'opal/stdlib/thread.rb', line 137

def path
  @path
end

Instance Method Details

#inspectObject



133
134
135
# File 'opal/stdlib/thread.rb', line 133

def inspect
  @str.inspect
end

#to_sObject



129
130
131
# File 'opal/stdlib/thread.rb', line 129

def to_s
  @str
end