Class: CodeObjectRolePresenter

Inherits:
BasePresenter show all
Defined in:
app/presenters/code_object_role_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?Boolean


4
5
6
# File 'app/presenters/code_object_role_presenter.rb', line 4

def bad?
  potential_score.to_i > 0
end

#nameObject


8
9
10
# File 'app/presenters/code_object_role_presenter.rb', line 8

def name
  code_object_role.code_object_role_name.name
end

#to_desc(object = nil) ⇒ Object


12
13
14
15
16
17
18
# File 'app/presenters/code_object_role_presenter.rb', line 12

def to_desc(object = nil)
  args = {
    :object_type => object && object.type,
    :ref_name => ref_name || object && object.name
  }
  I18n.t(to_i18n_key, args)
end

#to_i18n_keyObject


20
21
22
23
# File 'app/presenters/code_object_role_presenter.rb', line 20

def to_i18n_key
  to_partial.gsub('/', '.')
    .gsub(/\.inch\.language\.([^\.]+)\.evaluation\.role\./, '.\1.')
end

#to_partialObject


25
26
27
# File 'app/presenters/code_object_role_presenter.rb', line 25

def to_partial
  "shared/code_object_roles/#{name.underscore}"
end