Class: Inch::Language::Ruby::Provider::YARD::Object::NamespaceObject

Inherits:
Base
  • Object
show all
Defined in:
lib/inch/language/ruby/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::AUTO_GENERATED_TAG_NAMES, 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, #api_tag, #base_dir, #object, #parent

Instance Method Summary collapse

Methods inherited from Base

#__parent, #aliases_fullnames, #api_tag?, #core?, #depth, #docstring, #filename, #files, #fullname, #has_children?, #has_code_example?, #has_doc?, #has_multiple_code_examples?, #has_unconsidered_tags?, #in_root?, #initialize, #inspect, #method?, #name, #original_docstring, #parameters, #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::Language::Ruby::Provider::YARD::Object::Base

Instance Method Details

#attributesObject


10
11
12
13
# File 'lib/inch/language/ruby/provider/yard/object/namespace_object.rb', line 10

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

#child(name) ⇒ Object

called by MethodObject#getter?


32
33
34
# File 'lib/inch/language/ruby/provider/yard/object/namespace_object.rb', line 32

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

#childrenObject


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

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

#children_fullnamesObject


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

def children_fullnames
  children.map(&:fullname)
end

#has_methods?Boolean

Returns:

  • (Boolean)

23
24
25
# File 'lib/inch/language/ruby/provider/yard/object/namespace_object.rb', line 23

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

#namespace?Boolean

Returns:

  • (Boolean)

19
20
21
# File 'lib/inch/language/ruby/provider/yard/object/namespace_object.rb', line 19

def namespace?
  true
end

#pure_namespace?Boolean

Returns:

  • (Boolean)

27
28
29
# File 'lib/inch/language/ruby/provider/yard/object/namespace_object.rb', line 27

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