Class: AppMap::Handler::Rails::Template::TemplateMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/appmap/handler/rails/template.rb

Overview

All the code which is touched by the AppMap is recorded in the classMap. This duck-typed ‘method’ is used to represent a view template as a package, class, and method in the classMap. The class name is generated from the template path. The package name is ‘app/views’, and the method name is ‘render’. The source location of the method is, of course, the path to the view template.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ TemplateMethod



23
24
25
26
27
# File 'lib/appmap/handler/rails/template.rb', line 23

def initialize(path)
  @path = path

  @class_name = path.parameterize.underscore
end

Instance Attribute Details

#class_nameObject (readonly)

Returns the value of attribute class_name.



18
19
20
# File 'lib/appmap/handler/rails/template.rb', line 18

def class_name
  @class_name
end

#pathObject (readonly)

Returns the value of attribute path.



20
21
22
# File 'lib/appmap/handler/rails/template.rb', line 20

def path
  @path
end

Instance Method Details

#commentObject



57
58
59
# File 'lib/appmap/handler/rails/template.rb', line 57

def comment
  nil
end

#eql?(other) ⇒ Boolean



37
38
39
# File 'lib/appmap/handler/rails/template.rb', line 37

def eql?(other)
  other.is_a?(TemplateMethod) && id.eql?(other.id)
end

#hashObject



33
34
35
# File 'lib/appmap/handler/rails/template.rb', line 33

def hash
  id.hash
end

#idObject



29
30
31
# File 'lib/appmap/handler/rails/template.rb', line 29

def id
  [ package, path, name ]
end

#labelsObject



61
62
63
# File 'lib/appmap/handler/rails/template.rb', line 61

def labels
  [ 'mvc.template' ]
end

#nameObject



45
46
47
# File 'lib/appmap/handler/rails/template.rb', line 45

def name
  'render'
end

#packageObject



41
42
43
# File 'lib/appmap/handler/rails/template.rb', line 41

def package
  'app/views'
end

#source_locationObject



49
50
51
# File 'lib/appmap/handler/rails/template.rb', line 49

def source_location
  path
end

#staticObject



53
54
55
# File 'lib/appmap/handler/rails/template.rb', line 53

def static
  true
end