Class: Inch::CodeObject::Proxy::NamespaceObject

Inherits:
Base
  • Object
show all
Defined in:
lib/inch/code_object/proxy/namespace_object.rb

Overview

a namespace object can have methods and other namespace objects inside itself (e.g. classes and modules)

Direct Known Subclasses

ClassObject, ModuleObject

Constant Summary collapse

MANY_ATTRIBUTES_THRESHOLD =
5
MANY_CHILDREN_THRESHOLD =
20

Constants inherited from Base

Base::CONSIDERED_YARD_TAGS

Constants included from NodocHelper

NodocHelper::DOC_REGEX, NodocHelper::NO_DOC_ALL_REGEX, NodocHelper::NO_DOC_REGEX

Instance Attribute Summary

Attributes inherited from Base

#grade, #object

Instance Method Summary collapse

Methods inherited from Base

#depth, #docstring, #evaluation, #filename, #has_alias?, #has_code_example?, #has_doc?, #has_multiple_code_examples?, #has_unconsidered_tags?, #height, #in_root?, #initialize, #inspect, #method?, #parent, #private?, #private_tag?, #protected?, #public?, #unconsidered_tags, #undocumented?

Methods included from NodocHelper

#declarations, #explicit_doc_comment?, #explicit_nodoc_all_comment?, #explicit_nodoc_comment?, #files, #get_line_no, #implicit_nodoc_all_comment?, #implicit_nodoc_comment?, #nodoc?, #nodoc_comment?

Constructor Details

This class inherits a constructor from Inch::CodeObject::Proxy::Base

Instance Method Details

#childrenObject



7
8
9
10
11
# File 'lib/inch/code_object/proxy/namespace_object.rb', line 7

def children
  object.children.map do |o|
    Proxy.for(o)
  end
end

#has_many_attributes?Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/inch/code_object/proxy/namespace_object.rb', line 14

def has_many_attributes?
  n = object.class_attributes.size + object.instance_attributes.size
  n > MANY_ATTRIBUTES_THRESHOLD
end

#has_many_children?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/inch/code_object/proxy/namespace_object.rb', line 20

def has_many_children?
  children.size > MANY_CHILDREN_THRESHOLD
end

#namespace?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/inch/code_object/proxy/namespace_object.rb', line 24

def namespace?
  true
end

#no_methods?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/inch/code_object/proxy/namespace_object.rb', line 28

def no_methods?
  !children.any?(&:method?)
end

#pure_namespace?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/inch/code_object/proxy/namespace_object.rb', line 32

def pure_namespace?
  children.all?(&:namespace?)
end