Class: Inch::CodeObject::Provider::YARD::Object::NamespaceObject

Inherits:
Base
  • Object
show all
Defined in:
lib/inch/code_object/provider/yard/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, RootObject

Constant Summary

Constants inherited from Base

Base::CONSIDERED_YARD_TAGS, Base::RUBY_CORE

Constants included from NodocHelper

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

Instance Attribute Summary

Attributes inherited from Base

#aliased_object_fullname, #base_dir, #object

Instance Method Summary collapse

Methods inherited from Base

#__parent, #aliases_fullnames, #api_tag, #api_tag?, #core?, #depth, #docstring, #filename, #files, #fullname, #has_children?, #has_code_example?, #has_doc?, #has_multiple_code_examples?, #has_unconsidered_tags?, #in_in_root?, #in_root?, #initialize, #inspect, #method?, #name, #original_docstring, #parameters, #parent, #private?, #protected?, #public?, #tagged_as_internal_api?, #tagged_as_private?, #unconsidered_tag_count, #undocumented?

Methods included from NodocHelper

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

Constructor Details

This class inherits a constructor from Inch::CodeObject::Provider::YARD::Object::Base

Instance Method Details

#attributesObject



9
10
11
# File 'lib/inch/code_object/provider/yard/object/namespace_object.rb', line 9

def attributes
  object.class_attributes.values + object.instance_attributes.values
end

#child(name) ⇒ Object

called by MethodObject#getter?



30
31
32
33
34
# File 'lib/inch/code_object/provider/yard/object/namespace_object.rb', line 30

def child(name)
  if children
    children.detect { |child| child.name == name }
  end
end

#childrenObject



36
37
38
39
40
# File 'lib/inch/code_object/provider/yard/object/namespace_object.rb', line 36

def children
  object.children.map do |o|
    YARD::Object.for(o)
  end
end

#children_fullnamesObject



13
14
15
# File 'lib/inch/code_object/provider/yard/object/namespace_object.rb', line 13

def children_fullnames
  children.map(&:fullname)
end

#has_methods?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/inch/code_object/provider/yard/object/namespace_object.rb', line 21

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

#namespace?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/inch/code_object/provider/yard/object/namespace_object.rb', line 17

def namespace?
  true
end

#pure_namespace?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/inch/code_object/provider/yard/object/namespace_object.rb', line 25

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