lib/inch/evaluation/method_object.rb in inch-0.2.2 vs lib/inch/evaluation/method_object.rb in inch-0.2.3

- old
+ new

@@ -1,43 +1,31 @@ module Inch module Evaluation class MethodObject < Base def evaluate eval_doc + eval_code_example + eval_visibility + eval_tags + eval_parameters eval_return_type - eval_code_example eval_method - eval_misc end private - def eval_doc - if object.has_doc? - add_role Role::Object::WithDoc.new(object, score_for(:docstring)) - else - add_role Role::Object::WithoutDoc.new(object, score_for(:docstring)) - end - end - - def eval_code_example - if object.has_code_example? - if object.has_multiple_code_examples? - add_role Role::Object::WithMultipleCodeExamples.new(object, score_for(:code_example_multi)) - else - add_role Role::Object::WithCodeExample.new(object, score_for(:code_example_single)) - end - else - add_role Role::Object::WithoutCodeExample.new(object, score_for(:code_example_single)) - end - end - def eval_method if object.constructor? add_role Role::Method::Constructor.new(object) end + if object.getter? + add_role Role::Method::Getter.new(object) + end + if object.setter? + add_role Role::Method::Setter.new(object) + end if object.overridden? add_role Role::Method::Overridden.new(object, object.overridden_method.score) end if object.has_many_lines? add_role Role::Method::WithManyLines.new(object) @@ -48,38 +36,9 @@ if object.questioning_name? add_role Role::Method::WithQuestioningName.new(object) end if object.has_alias? add_role Role::Method::HasAlias.new(object) - end - end - - def eval_misc - if object.nodoc? - add_role Role::Object::TaggedAsNodoc.new(object) - end - if object.api_tag? - if object.private_api_tag? - add_role Role::Object::TaggedAsPrivateAPI.new(object) - else - add_role Role::Object::TaggedAsAPI.new(object) - end - end - if object.has_unconsidered_tags? - count = object.unconsidered_tags.size - add_role Role::Object::Tagged.new(object, score_for(:unconsidered_tag) * count) - end - if object.in_root? - add_role Role::Object::InRoot.new(object) - end - if object.public? - add_role Role::Object::Public.new(object) - end - if object.protected? - add_role Role::Object::Protected.new(object) - end - if object.private? - add_role Role::Object::Private.new(object) end end def eval_parameters if object.has_parameters?