Class: Inch::CodeObject::Provider::YARD::Object::MethodObject
- Inherits:
-
Base
- Object
- Base
- Inch::CodeObject::Provider::YARD::Object::MethodObject
show all
- Defined in:
- lib/inch/code_object/provider/yard/object/method_object.rb
Overview
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, #base_dir, #object
Instance Method Summary
collapse
Methods inherited from Base
#__parent, #api_tag, #api_tag?, #child, #children, #children_fullnames, #core?, #depth, #docstring, #filename, #files, #fullname, #has_children?, #has_multiple_code_examples?, #has_unconsidered_tags?, #in_in_root?, #in_root?, #initialize, #inspect, #name, #namespace?, #original_docstring, #parent, #private?, #protected?, #public?, #tagged_as_internal_api?, #tagged_as_private?, #unconsidered_tag_count, #undocumented?
#declarations, #explicit_doc_comment?, #explicit_nodoc_all_comment?, #explicit_nodoc_comment?, #get_line_no, #implicit_nodoc_all_comment?, #implicit_nodoc_comment?, #nodoc?, #nodoc_comment?
Instance Method Details
#aliases_fullnames ⇒ Object
10
11
12
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 10
def aliases_fullnames
object.aliases.map(&:path)
end
|
#bang_name? ⇒ Boolean
14
15
16
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 14
def bang_name?
name =~ /\!$/
end
|
#constructor? ⇒ Boolean
18
19
20
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 18
def constructor?
name == :initialize
end
|
#getter? ⇒ Boolean
22
23
24
25
26
27
28
29
30
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 22
def getter?
attr_info = object.attr_info || {}
read_info = attr_info[:read]
if read_info
read_info.path == fullname
else
parent.child(:"#{name}=")
end
end
|
#has_code_example? ⇒ Boolean
32
33
34
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 32
def has_code_example?
signatures.any? { |s| s.has_code_example? }
end
|
#has_doc? ⇒ Boolean
36
37
38
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 36
def has_doc?
signatures.any? { |s| s.has_doc? }
end
|
#method? ⇒ Boolean
40
41
42
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 40
def method?
true
end
|
#overridden? ⇒ Boolean
52
53
54
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 52
def overridden?
!!object.overridden_method
end
|
#overridden_method ⇒ Object
56
57
58
59
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 56
def overridden_method
return unless overridden?
@overridden_method ||= YARD::Object.for(object.overridden_method)
end
|
#overridden_method_fullname ⇒ Object
61
62
63
64
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 61
def overridden_method_fullname
return unless overridden?
overridden_method.fullname
end
|
#parameter(name) ⇒ Object
48
49
50
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 48
def parameter(name)
parameters.detect { |p| p.name == name.to_s }
end
|
#parameters ⇒ Object
44
45
46
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 44
def parameters
@parameters ||= signatures.map(&:parameters).flatten
end
|
#questioning_name? ⇒ Boolean
99
100
101
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 99
def questioning_name?
name =~ /\?$/
end
|
#return_described? ⇒ Boolean
Returns true
if a return value is described by words.
74
75
76
77
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 74
def return_described?
return_tags.any? { |t| !t.text.empty? && !YARD.implicit_tag?(t, self) } ||
docstring.describes_return? && !implicit_docstring?
end
|
#return_mentioned? ⇒ Boolean
Returns true
if a return value is described by it’s type or mentioned in the docstring (e.g. “Returns a String”).
68
69
70
71
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 68
def return_mentioned?
return_tags.any? { |t| !t.types.nil? && !t.types.empty? && !YARD.implicit_tag?(t, self) } ||
docstring.mentions_return? && !implicit_docstring?
end
|
#return_typed? ⇒ Boolean
79
80
81
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 79
def return_typed?
return_mentioned?
end
|
#setter? ⇒ Boolean
83
84
85
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 83
def setter?
name =~ /\=$/ && parameters.size == 1
end
|
#signatures ⇒ Object
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 87
def signatures
base = MethodSignature.new(self, nil)
overloaded = overload_tags.map do |tag|
MethodSignature.new(self, tag)
end
if overloaded.any? { |s| s.same?(base) }
overloaded
else
[base] + overloaded
end
end
|