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

Returns a new instance of TemplateMethod.



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

def initialize(path)
  @path = path

  @class_name = path.parameterize.underscore
end

Instance Attribute Details

#class_nameObject (readonly)

Returns the value of attribute class_name.



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

def class_name
  @class_name
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#commentObject



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

def comment
  nil
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#hashObject



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

def hash
  id.hash
end

#idObject



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

def id
  [ package, path, name ]
end

#labelsObject



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

def labels
  [ 'mvc.template' ]
end

#nameObject



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

def name
  'render'
end

#packageObject



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

def package
  'app/views'
end

#source_locationObject



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

def source_location
  path
end

#staticObject



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

def static
  true
end