Class: Jazzy::SourceDeclaration
- Inherits:
-
Object
- Object
- Jazzy::SourceDeclaration
- Defined in:
- lib/jazzy/source_declaration.rb,
lib/jazzy/source_declaration/type.rb,
lib/jazzy/source_declaration/access_control_level.rb
Direct Known Subclasses
Defined Under Namespace
Classes: AccessControlLevel, Type
Instance Attribute Summary collapse
-
#abstract ⇒ Object
Returns the value of attribute abstract.
-
#access_control_level ⇒ Object
Returns the value of attribute access_control_level.
-
#children ⇒ Object
counterpart of parent_in_docs.
-
#column ⇒ Object
Returns the value of attribute column.
-
#declaration ⇒ Object
Returns the value of attribute declaration.
-
#default_impl_abstract ⇒ Object
Returns the value of attribute default_impl_abstract.
-
#discussion ⇒ Object
Returns the value of attribute discussion.
-
#end_line ⇒ Object
Returns the value of attribute end_line.
-
#file ⇒ Object
Returns the value of attribute file.
-
#from_protocol_extension ⇒ Object
Returns the value of attribute from_protocol_extension.
-
#line ⇒ Object
Returns the value of attribute line.
-
#mark ⇒ Object
Returns the value of attribute mark.
-
#modulename ⇒ Object
Returns the value of attribute modulename.
-
#name ⇒ Object
Returns the value of attribute name.
-
#nav_order ⇒ Object
Returns the value of attribute nav_order.
-
#other_language_declaration ⇒ Object
Returns the value of attribute other_language_declaration.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#parent_in_code ⇒ Object
Element containing this declaration in the code.
-
#parent_in_docs ⇒ Object
Logical parent in the documentation.
-
#return ⇒ Object
Returns the value of attribute return.
-
#start_line ⇒ Object
Returns the value of attribute start_line.
-
#type ⇒ Object
kind of declaration (e.g. class, variable, function).
-
#typename ⇒ Object
static type of declared element (e.g. String.Type -> ()).
-
#url ⇒ Object
Returns the value of attribute url.
-
#url_name ⇒ Object
Returns the value of attribute url_name.
-
#usr ⇒ Object
Returns the value of attribute usr.
Instance Method Summary collapse
- #abstract_glob ⇒ Object
- #alternative_abstract ⇒ Object
- #alternative_abstract_file ⇒ Object
- #fully_qualified_name ⇒ Object
- #namespace_ancestors ⇒ Object
-
#namespace_path ⇒ Object
Chain of parent_in_code from top level to self.
-
#objc_category_name ⇒ Object
If this declaration is an objc category, returns an array with the name of the extended objc class and the category name itself, i.e.
- #render? ⇒ Boolean
- #type?(type_kind) ⇒ Boolean
Instance Attribute Details
#abstract ⇒ Object
Returns the value of attribute abstract.
67 68 69 |
# File 'lib/jazzy/source_declaration.rb', line 67 def abstract @abstract end |
#access_control_level ⇒ Object
Returns the value of attribute access_control_level.
75 76 77 |
# File 'lib/jazzy/source_declaration.rb', line 75 def access_control_level @access_control_level end |
#children ⇒ Object
counterpart of parent_in_docs
27 28 29 |
# File 'lib/jazzy/source_declaration.rb', line 27 def children @children end |
#column ⇒ Object
Returns the value of attribute column.
61 62 63 |
# File 'lib/jazzy/source_declaration.rb', line 61 def column @column end |
#declaration ⇒ Object
Returns the value of attribute declaration.
65 66 67 |
# File 'lib/jazzy/source_declaration.rb', line 65 def declaration @declaration end |
#default_impl_abstract ⇒ Object
Returns the value of attribute default_impl_abstract.
68 69 70 |
# File 'lib/jazzy/source_declaration.rb', line 68 def default_impl_abstract @default_impl_abstract end |
#discussion ⇒ Object
Returns the value of attribute discussion.
70 71 72 |
# File 'lib/jazzy/source_declaration.rb', line 70 def discussion @discussion end |
#end_line ⇒ Object
Returns the value of attribute end_line.
77 78 79 |
# File 'lib/jazzy/source_declaration.rb', line 77 def end_line @end_line end |
#file ⇒ Object
Returns the value of attribute file.
59 60 61 |
# File 'lib/jazzy/source_declaration.rb', line 59 def file @file end |
#from_protocol_extension ⇒ Object
Returns the value of attribute from_protocol_extension.
69 70 71 |
# File 'lib/jazzy/source_declaration.rb', line 69 def from_protocol_extension @from_protocol_extension end |
#line ⇒ Object
Returns the value of attribute line.
60 61 62 |
# File 'lib/jazzy/source_declaration.rb', line 60 def line @line end |
#mark ⇒ Object
Returns the value of attribute mark.
74 75 76 |
# File 'lib/jazzy/source_declaration.rb', line 74 def mark @mark end |
#modulename ⇒ Object
Returns the value of attribute modulename.
63 64 65 |
# File 'lib/jazzy/source_declaration.rb', line 63 def modulename @modulename end |
#name ⇒ Object
Returns the value of attribute name.
64 65 66 |
# File 'lib/jazzy/source_declaration.rb', line 64 def name @name end |
#nav_order ⇒ Object
Returns the value of attribute nav_order.
78 79 80 |
# File 'lib/jazzy/source_declaration.rb', line 78 def nav_order @nav_order end |
#other_language_declaration ⇒ Object
Returns the value of attribute other_language_declaration.
66 67 68 |
# File 'lib/jazzy/source_declaration.rb', line 66 def other_language_declaration @other_language_declaration end |
#parameters ⇒ Object
Returns the value of attribute parameters.
72 73 74 |
# File 'lib/jazzy/source_declaration.rb', line 72 def parameters @parameters end |
#parent_in_code ⇒ Object
Element containing this declaration in the code
20 21 22 |
# File 'lib/jazzy/source_declaration.rb', line 20 def parent_in_code @parent_in_code end |
#parent_in_docs ⇒ Object
Logical parent in the documentation. May differ from parent_in_code because of top-level categories and merged extensions.
24 25 26 |
# File 'lib/jazzy/source_declaration.rb', line 24 def parent_in_docs @parent_in_docs end |
#return ⇒ Object
Returns the value of attribute return.
71 72 73 |
# File 'lib/jazzy/source_declaration.rb', line 71 def return @return end |
#start_line ⇒ Object
Returns the value of attribute start_line.
76 77 78 |
# File 'lib/jazzy/source_declaration.rb', line 76 def start_line @start_line end |
#type ⇒ Object
kind of declaration (e.g. class, variable, function)
7 8 9 |
# File 'lib/jazzy/source_declaration.rb', line 7 def type @type end |
#typename ⇒ Object
static type of declared element (e.g. String.Type -> ())
9 10 11 |
# File 'lib/jazzy/source_declaration.rb', line 9 def typename @typename end |
#url ⇒ Object
Returns the value of attribute url.
73 74 75 |
# File 'lib/jazzy/source_declaration.rb', line 73 def url @url end |
#url_name ⇒ Object
Returns the value of attribute url_name.
79 80 81 |
# File 'lib/jazzy/source_declaration.rb', line 79 def url_name @url_name end |
#usr ⇒ Object
Returns the value of attribute usr.
62 63 64 |
# File 'lib/jazzy/source_declaration.rb', line 62 def usr @usr end |
Instance Method Details
#abstract_glob ⇒ Object
94 95 96 97 98 99 |
# File 'lib/jazzy/source_declaration.rb', line 94 def abstract_glob return [] unless Config.instance.abstract_glob_configured && Config.instance.abstract_glob Config.instance.abstract_glob.select { |e| File.file? e } end |
#alternative_abstract ⇒ Object
81 82 83 84 85 |
# File 'lib/jazzy/source_declaration.rb', line 81 def alternative_abstract if file = alternative_abstract_file Pathname(file).read end end |
#alternative_abstract_file ⇒ Object
87 88 89 90 91 92 |
# File 'lib/jazzy/source_declaration.rb', line 87 def alternative_abstract_file abstract_glob.select do |f| # allow Structs.md or Structures.md [name, url_name].include?(File.basename(f).split('.').first) end.first end |
#fully_qualified_name ⇒ Object
48 49 50 |
# File 'lib/jazzy/source_declaration.rb', line 48 def fully_qualified_name namespace_path.map(&:name).join('.') end |
#namespace_ancestors ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/jazzy/source_declaration.rb', line 40 def namespace_ancestors if parent_in_code parent_in_code.namespace_path else [] end end |
#namespace_path ⇒ Object
Chain of parent_in_code from top level to self. (Includes self.)
36 37 38 |
# File 'lib/jazzy/source_declaration.rb', line 36 def namespace_path namespace_ancestors + [self] end |
#objc_category_name ⇒ Object
If this declaration is an objc category, returns an array with the name of the extended objc class and the category name itself, i.e. [“NSString”, “MyMethods”], nil otherwise.
55 56 57 |
# File 'lib/jazzy/source_declaration.rb', line 55 def objc_category_name name.split(/[\(\)]/) if type.objc_category? end |
#render? ⇒ Boolean
15 16 17 |
# File 'lib/jazzy/source_declaration.rb', line 15 def render? type?('document.markdown') || children.count != 0 end |
#type?(type_kind) ⇒ Boolean
11 12 13 |
# File 'lib/jazzy/source_declaration.rb', line 11 def type?(type_kind) respond_to?(:type) && type.kind == type_kind end |