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::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_code_example?, #has_multiple_code_examples?, #has_unconsidered_tags?, #in_in_root?, #in_root?, #initialize, #inspect, #name, #namespace?, #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
8
9
10
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 8
def aliases_fullnames
object.aliases.map(&:path)
end
|
#bang_name? ⇒ Boolean
12
13
14
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 12
def bang_name?
name =~ /\!$/
end
|
#constructor? ⇒ Boolean
16
17
18
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 16
def constructor?
name == :initialize
end
|
#getter? ⇒ Boolean
20
21
22
23
24
25
26
27
28
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 20
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_doc? ⇒ Boolean
30
31
32
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 30
def has_doc?
super && !implicit_docstring? || overload_tags.any? { |t| !t.docstring.empty? }
end
|
#method? ⇒ Boolean
34
35
36
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 34
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
38
39
40
41
42
43
44
45
46
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 38
def parameters
@parameters ||= all_parameter_names.map do |name|
signature_name = in_signature(name)
tag = parameter_tag(name) || parameter_tag(signature_name) ||
param_tag_in_overload_tags(name) ||
param_tag_in_overload_tags(signature_name)
MethodParameterObject.new(self, name, signature_name, tag)
end
end
|
#questioning_name? ⇒ Boolean
83
84
85
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 83
def questioning_name?
name =~ /\?$/
end
|
#return_described? ⇒ Boolean
70
71
72
73
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 70
def return_described?
return_tags.any? { |t| !t.text.empty? } ||
docstring.describes_return?
end
|
#return_mentioned? ⇒ Boolean
66
67
68
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 66
def return_mentioned?
!return_tags.empty? || docstring.mentions_return?
end
|
#return_typed? ⇒ Boolean
75
76
77
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 75
def return_typed?
return_mentioned?
end
|
#setter? ⇒ Boolean
79
80
81
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 79
def setter?
name =~ /\=$/ && parameters.size == 1
end
|