lib/inch/evaluation/role/namespace.rb in inch-0.2.3 vs lib/inch/evaluation/role/namespace.rb in inch-0.3.0.rc1
- old
+ new
@@ -2,11 +2,15 @@
module Evaluation
module Role
# Roles assigned to namespaces (classes and modules)
module Namespace
# Role assigned to namespaces with children
+ #
+ # @see CodeObject::Proxy::NamespaceObject#has_children?
class WithChildren < Base
+ applicable_if :has_children?
+
# This role doesnot assign a score.
def score
0
end
@@ -18,39 +22,48 @@
# Role assigned to namespaces with many children
#
# @see CodeObject::Proxy::NamespaceObject#has_many_children?
class WithManyChildren < Base
+ applicable_if :has_many_children?
+
# +priority
def priority
+1
end
end
# Role assigned to namespaces with many attributes
#
# @see CodeObject::Proxy::NamespaceObject#has_many_attributes?
class WithManyAttributes < Base
+ applicable_if :has_many_attributes?
+
# +priority
def priority
+1
end
end
# Role assigned to namespaces without any children
class WithoutChildren < Base
+ applicable_unless :has_children?
end
# Role assigned to namespaces without any methods
class WithoutMethods < Base
+ applicable_unless :has_methods?
+
def priority
-2
end
end
# A 'pure' namespace has only namespaces as children
class Pure < Base
+ applicable_if :pure_namespace?
+
def priority
-2
end
end
@@ -58,9 +71,11 @@
# core. It might appear in the object tree when monkey-patching
# functionality.
# (the reasoning here is: just because we patch Hash does not mean
# we need to document the Hash class itself)
class Core < Base
+ applicable_if :core?
+
def priority
-7
end
end
end