Class: Call

Inherits:
Struct
  • Object
show all
Defined in:
lib/antlr3/test/call-stack.rb,
lib/antlr3/test/call-stack.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fileObject

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



5
6
7
# File 'lib/antlr3/test/call-stack.rb', line 5

def file
  @file
end

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



5
6
7
# File 'lib/antlr3/test/call-stack.rb', line 5

def line
  @line
end

#methodObject

Returns the value of attribute method

Returns:

  • (Object)

    the current value of 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

Returns:

  • (Boolean)


30
31
32
# File 'lib/antlr3/test/call-stack.rb', line 30

def e_switch?
  self.file == '-e'
end

#inspectObject



40
41
42
# File 'lib/antlr3/test/call-stack.rb', line 40

def inspect
  to_s.inspect
end

#irb?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/antlr3/test/call-stack.rb', line 26

def irb?
  self.file == '(irb)'
end

#to_sObject



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