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
#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
#bang_name? ⇒ Boolean
13
14
15
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 13
def bang_name?
name =~ /\!$/
end
|
#constructor? ⇒ Boolean
9
10
11
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 9
def constructor?
name == :initialize
end
|
#getter? ⇒ Boolean
17
18
19
20
21
22
23
24
25
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 17
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_alias? ⇒ Boolean
31
32
33
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 31
def has_alias?
!object.aliases.empty?
end
|
#has_doc? ⇒ Boolean
27
28
29
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 27
def has_doc?
super && !implicit_docstring?
end
|
#method? ⇒ Boolean
35
36
37
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 35
def method?
true
end
|
#overridden? ⇒ Boolean
51
52
53
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 51
def overridden?
!!object.overridden_method
end
|
#overridden_method ⇒ Object
55
56
57
58
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 55
def overridden_method
return unless overridden?
@overridden_method ||= YARD::Object.for(object.overridden_method)
end
|
#overridden_method_fullname ⇒ Object
60
61
62
63
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 60
def overridden_method_fullname
return unless overridden?
overridden_method.fullname
end
|
#parameter(name) ⇒ Object
47
48
49
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 47
def parameter(name)
parameters.detect { |p| p.name == name.to_s }
end
|
#parameters ⇒ Object
39
40
41
42
43
44
45
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 39
def parameters
@parameters ||= all_parameter_names.map do |name|
signature_name = in_signature(name)
tag = parameter_tag(name) || parameter_tag(signature_name)
MethodParameterObject.new(self, name, signature_name, tag)
end
end
|
#questioning_name? ⇒ Boolean
81
82
83
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 81
def questioning_name?
name =~ /\?$/
end
|
#return_described? ⇒ Boolean
69
70
71
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 69
def return_described?
(return_tag && !return_tag.text.empty?) || docstring.describes_return?
end
|
#return_mentioned? ⇒ Boolean
65
66
67
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 65
def return_mentioned?
!!return_tag || docstring.mentions_return?
end
|
#return_typed? ⇒ Boolean
73
74
75
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 73
def return_typed?
return_mentioned?
end
|
#setter? ⇒ Boolean
77
78
79
|
# File 'lib/inch/code_object/provider/yard/object/method_object.rb', line 77
def setter?
name =~ /\=$/ && parameters.size == 1
end
|