Class: StackDeck::Frame

Inherits:
Object
  • Object
show all
Defined in:
lib/stackdeck/frame.rb,
lib/stackdeck/postgres.rb

Direct Known Subclasses

JavaScript, Postgres::Function, Ruby, SQL

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

Returns a new instance of 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

#clueObject

Returns the value of attribute clue.



27
28
29
# File 'lib/stackdeck/frame.rb', line 27

def clue
  @clue
end

#filenameObject

Returns the value of attribute filename.



27
28
29
# File 'lib/stackdeck/frame.rb', line 27

def filename
  @filename
end

#functionObject

Returns the value of attribute function.



27
28
29
# File 'lib/stackdeck/frame.rb', line 27

def function
  @function
end

#linenoObject

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

Returns:

  • (Boolean)


41
# File 'lib/stackdeck/frame.rb', line 41

def boundary?; false; end

#contextObject



34
35
36
# File 'lib/stackdeck/frame.rb', line 34

def context
  @context ||= Context::File.new(filename, lineno) if filename
end

#languageObject



40
# File 'lib/stackdeck/frame.rb', line 40

def language; self.class.name.split('::').last; end

#same_line?(other) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/stackdeck/frame.rb', line 37

def same_line?(other)
  other && self.filename == other.filename && self.lineno == other.lineno
end

#to_sObject



43
44
45
# File 'lib/stackdeck/frame.rb', line 43

def to_s
  "#{filename}:#{lineno}: in `#{function}' [#{language}]"
end