Class: BetterRailsDebugger::GroupInstancesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/better_rails_debugger/group_instances_controller.rb

Instance Method Summary collapse

Instance Method Details

#backtraceObject



58
59
60
61
62
63
64
65
66
67
# File 'app/controllers/better_rails_debugger/group_instances_controller.rb', line 58

def backtrace
  begin
    @instance = GroupInstance.find params[:id]
  rescue Mongoid::Errors::DocumentNotFound
    redirect_to analysis_groups_path, flash: {error: 'Instance not found'}
    return
  end
  @backtraces = ::BetterRailsDebugger::TracePointItem.backtraces_for(params[:id], params[:file], params[:line].to_i)
  pp @backtraces
end

#codeObject



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/controllers/better_rails_debugger/group_instances_controller.rb', line 44

def code
  begin
    @object = ObjectInformation.find(params[:object_id])
  rescue Mongoid::Errors::DocumentNotFound
    redirect_to group_instance_path(params[:id]), flash: {error: 'Object not found'}
    return
  end
  # Verify object existence
  theme = Rouge::Themes::Github.new
  formatter = Rouge::Formatters::HTMLInline.new theme
  lexer = Rouge::Lexers::Ruby.new
  render plain: formatter.format(lexer.lex(@object.source_code || ""))
end

#objectsObject



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/better_rails_debugger/group_instances_controller.rb', line 30

def objects
  begin
    @instance = GroupInstance.find params[:id]
  rescue Mongoid::Errors::DocumentNotFound
    redirect_to analysis_groups_path, flash: {error: 'Instance not found'}
    return
  end
  @objects = @instance.objects.order(created_at: 'desc').limit(20)
  filter_objects
  @objects = @objects.paginate(page: (params[:page] || 1), per_page: 20)

  @file_allocations = @instance.files_with_more_allocations(4)
end

#showObject



5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/better_rails_debugger/group_instances_controller.rb', line 5

def show
  begin
    @instance = GroupInstance.find params[:id]
  rescue Mongoid::Errors::DocumentNotFound
    redirect_to analysis_groups_path, flash: {error: 'Instance not found'}
    return
  end
  @most_used_methods = @instance.most_used_methods(4)
  @file_allocations  = @instance.files_with_more_allocations(4)
end

#tracerObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/better_rails_debugger/group_instances_controller.rb', line 16

def tracer
  begin
    @instance = GroupInstance.find params[:id]
  rescue Mongoid::Errors::DocumentNotFound
    redirect_to analysis_groups_path, flash: {error: 'Instance not found'}
    return
  end
  @traces = @instance.trace_point_items.order(created_at: 'desc').limit(20)
  filter_traces
  @traces = @traces.paginate(page: (params[:page] || 1), per_page: 20)

  @file_allocations = @instance.files_with_more_allocations(4)
end