Class: Call
- Inherits:
-
Struct
- Object
- Struct
- Call
- Defined in:
- lib/antlr3/test/call-stack.rb,
lib/antlr3/test/call-stack.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#line ⇒ Object
Returns the value of attribute line.
-
#method ⇒ Object
Returns the value of attribute method.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file
5 6 7 |
# File 'lib/antlr3/test/call-stack.rb', line 5 def file @file end |
#line ⇒ Object
Returns the value of attribute line
5 6 7 |
# File 'lib/antlr3/test/call-stack.rb', line 5 def line @line end |
#method ⇒ Object
Returns the value of attribute method
5 6 7 |
# File 'lib/antlr3/test/call-stack.rb', line 5 def method @method end |
Class Method Details
.convert_backtrace(trace) ⇒ Object
22 23 24 |
# File 'lib/antlr3/test/call-stack.rb', line 22 def self.convert_backtrace( trace ) trace.map { |c| parse c } end |
.parse(call_string) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/antlr3/test/call-stack.rb', line 8 def self.parse( call_string ) parts = call_string.split( ':', 3 ) file = parts.shift line = parts.shift.to_i if parts.empty? return Call.new( file, line ) else mstring = parts.shift match = mstring.match( /`(.+)'/ ) method = match ? match[ 1 ] : nil return Call.new( file, line, method ) end end |
Instance Method Details
#e_switch? ⇒ Boolean
30 31 32 |
# File 'lib/antlr3/test/call-stack.rb', line 30 def e_switch? self.file == '-e' end |
#inspect ⇒ Object
40 41 42 |
# File 'lib/antlr3/test/call-stack.rb', line 40 def inspect to_s.inspect end |
#irb? ⇒ Boolean
26 27 28 |
# File 'lib/antlr3/test/call-stack.rb', line 26 def irb? self.file == '(irb)' end |
#to_s ⇒ Object
34 35 36 37 38 |
# File 'lib/antlr3/test/call-stack.rb', line 34 def to_s string = '%s:%i' % [ file, line ] method and string << ":in `%s'" % method return( string ) end |