Class: StackDeck::Frame
- Inherits:
-
Object
show all
- Defined in:
- lib/stackdeck/frame.rb,
lib/stackdeck/postgres.rb
Defined Under Namespace
Modules: Postgres
Classes: JavaScript, Ruby, SQL
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(function, filename, lineno, clue = nil) ⇒ Frame
28
29
30
31
32
33
|
# File 'lib/stackdeck/frame.rb', line 28
def initialize(function, filename, lineno, clue=nil)
@function = function
@filename = filename unless filename && filename.empty?
@lineno = lineno
@clue = clue unless clue && clue.empty?
end
|
Instance Attribute Details
#clue ⇒ Object
Returns the value of attribute clue.
27
28
29
|
# File 'lib/stackdeck/frame.rb', line 27
def clue
@clue
end
|
#filename ⇒ Object
Returns the value of attribute filename.
27
28
29
|
# File 'lib/stackdeck/frame.rb', line 27
def filename
@filename
end
|
#function ⇒ Object
Returns the value of attribute function.
27
28
29
|
# File 'lib/stackdeck/frame.rb', line 27
def function
@function
end
|
#lineno ⇒ Object
Returns the value of attribute lineno.
27
28
29
|
# File 'lib/stackdeck/frame.rb', line 27
def lineno
@lineno
end
|
Instance Method Details
#boundary? ⇒ Boolean
44
|
# File 'lib/stackdeck/frame.rb', line 44
def boundary?; false; end
|
#context ⇒ Object
34
35
36
|
# File 'lib/stackdeck/frame.rb', line 34
def context
@context ||= Context::File.new(filename, lineno) if filename
end
|
#context? ⇒ Boolean
37
38
39
|
# File 'lib/stackdeck/frame.rb', line 37
def context?
!filename.nil?
end
|
#language ⇒ Object
43
|
# File 'lib/stackdeck/frame.rb', line 43
def language; self.class.name.split('::').last; end
|
#same_line?(other) ⇒ Boolean
40
41
42
|
# File 'lib/stackdeck/frame.rb', line 40
def same_line?(other)
other && self.filename == other.filename && self.lineno == other.lineno
end
|
#to_s ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/stackdeck/frame.rb', line 46
def to_s
if filename
if function && function != ''
"#{filename}:#{lineno}:in `#{function}' [#{language}]"
else
"#{filename}:#{lineno} [#{language}]"
end
else
if function && function != ''
"(#{language}):#{lineno}:in `#{function}'"
else
"(#{language}):#{lineno}"
end
end
end
|