Class: Inch::Language::Ruby::CodeObject::NamespaceObject

Inherits:
Base show all
Defined in:
lib/inch/language/ruby/code_object/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 CodeObject::Proxy

#object_lookup

Instance Method Summary collapse

Methods inherited from Base

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

Methods inherited from CodeObject::Proxy

#[], for, #initialize, #inspect, #language, #marshal_dump, #marshal_load

Constructor Details

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

Instance Method Details

#attributesObject

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


10
11
12
# File 'lib/inch/language/ruby/code_object/namespace_object.rb', line 10

def attributes
  self[:attributes]
end

#has_many_attributes?Boolean


15
16
17
# File 'lib/inch/language/ruby/code_object/namespace_object.rb', line 15

def has_many_attributes?
  attributes.size > MANY_ATTRIBUTES_THRESHOLD
end

#has_many_children?Boolean


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

def has_many_children?
  children.size > MANY_CHILDREN_THRESHOLD
end

#has_methods?Boolean


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

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

#pure_namespace?Boolean


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

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