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

Instance Attribute Summary

Attributes inherited from Base

#grade, #object_lookup

Instance Method Summary collapse

Methods inherited from Base

#[], #alias?, #aliased_object, #api_tag?, #children, #constant?, #core?, #depth, #docstring, #evaluation, #filename, #files, #fullname, #has_alias?, #has_children?, #has_code_example?, #has_doc?, #has_multiple_code_examples?, #has_unconsidered_tags?, #in_root?, #initialize, #inspect, #marshal_dump, #marshal_load, #method?, #name, #namespace?, #nodoc?, #original_docstring, #parent, #private?, #protected?, #public?, #source, #tagged_as_internal_api?, #tagged_as_private?, #type, #unconsidered_tag_count, #undocumented?, #visibility

Constructor Details

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

Instance Method Details

#attributesObject

The wording is a bit redundant, but this means the class and instance attributes of the namespace



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

def attributes
  self[:attributes]
end

#has_many_attributes?Boolean

Returns:

  • (Boolean)


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

def has_many_attributes?
  attributes.size > MANY_ATTRIBUTES_THRESHOLD
end

#has_many_children?Boolean

Returns:

  • (Boolean)


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

def has_many_children?
  children.size > MANY_CHILDREN_THRESHOLD
end

#has_methods?Boolean

Returns:

  • (Boolean)


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

def has_methods?
  children.any?(&:method?)
end

#pure_namespace?Boolean

Returns:

  • (Boolean)


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

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