Class: Tracia::Frame

Inherits:
Object
  • Object
show all
Includes:
TreeGraph, TreeHtml
Defined in:
lib/tracia/frame.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, call_sym, method_name, file, lineno) ⇒ Frame

Returns a new instance of Frame.



12
13
14
15
16
17
18
19
# File 'lib/tracia/frame.rb', line 12

def initialize(klass, call_sym, method_name, file, lineno)
  @klass = klass
  @call_sym = call_sym
  @method_name = method_name
  @file = file
  @lineno = lineno
  @children = []
end

Instance Attribute Details

#call_symObject (readonly)

Returns the value of attribute call_sym.



10
11
12
# File 'lib/tracia/frame.rb', line 10

def call_sym
  @call_sym
end

#childrenObject (readonly)

Returns the value of attribute children.



10
11
12
# File 'lib/tracia/frame.rb', line 10

def children
  @children
end

#fileObject (readonly)

Returns the value of attribute file.



10
11
12
# File 'lib/tracia/frame.rb', line 10

def file
  @file
end

#klassObject (readonly)

Returns the value of attribute klass.



10
11
12
# File 'lib/tracia/frame.rb', line 10

def klass
  @klass
end

#linenoObject (readonly)

Returns the value of attribute lineno.



10
11
12
# File 'lib/tracia/frame.rb', line 10

def lineno
  @lineno
end

#method_nameObject (readonly)

Returns the value of attribute method_name.



10
11
12
# File 'lib/tracia/frame.rb', line 10

def method_name
  @method_name
end

Instance Method Details

#children_for_tree_graphObject



31
32
33
# File 'lib/tracia/frame.rb', line 31

def children_for_tree_graph
  children
end

#children_for_tree_htmlObject



39
40
41
# File 'lib/tracia/frame.rb', line 39

def children_for_tree_html
  children
end

#css_for_tree_htmlObject



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

def css_for_tree_html
  '.hl{color: #a50000;}'
end

#label_for_tree_graphObject



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

def label_for_tree_graph
  "#{class_and_method} #{source_location}"
end

#label_for_tree_htmlObject



35
36
37
# File 'lib/tracia/frame.rb', line 35

def label_for_tree_html
  "<span class='hl'>#{CGI::escapeHTML(class_and_method)}</span> #{CGI::escapeHTML(source_location)}"
end

#same_klass_and_method?(other_frame) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
# File 'lib/tracia/frame.rb', line 21

def same_klass_and_method?(other_frame)
  klass == other_frame.klass &&
    call_sym == other_frame.call_sym &&
    method_name == other_frame.method_name
end