Class: CodeObjectPresenter

Inherits:
BasePresenter show all
Defined in:
app/presenters/code_object_presenter.rb

Instance Method Summary collapse

Methods inherited from BasePresenter

inherited, #initialize, #to_model, use_presenters

Constructor Details

This class inherits a constructor from BasePresenter

Instance Method Details

#bad_code_object_rolesObject


8
9
10
11
12
# File 'app/presenters/code_object_presenter.rb', line 8

def bad_code_object_roles
  code_object_roles.select(&:bad?).sort_by do |role|
    [role.potential_score.to_i, role.name]
  end.reverse
end

#filenameObject


14
15
16
# File 'app/presenters/code_object_presenter.rb', line 14

def filename
  location.first
end

#line_noObject


18
19
20
# File 'app/presenters/code_object_presenter.rb', line 18

def line_no
  location.last
end

#nameObject


22
23
24
# File 'app/presenters/code_object_presenter.rb', line 22

def name
  fullname.split('::').last.split('#').last
end

#priority_symbol(priority = @resource.priority) ⇒ Object


26
27
28
29
30
31
32
# File 'app/presenters/code_object_presenter.rb', line 26

def priority_symbol(priority = @resource.priority)
  ::Inch::Evaluation::PriorityRange.all.each do |range|
    if range.include?(priority)
      return range.to_sym
    end
  end
end

#typeObject


34
35
36
# File 'app/presenters/code_object_presenter.rb', line 34

def type
  @resource.type.split('::').last.downcase
end