Class: Inch::CodeObject::Proxy::MethodObject
- Inherits:
-
Base
- Object
- Base
- Inch::CodeObject::Proxy::MethodObject
show all
- Defined in:
- lib/inch/code_object/proxy/method_object.rb
Overview
Constant Summary
collapse
- MANY_PARAMETERS_THRESHOLD =
3
- MANY_LINES_THRESHOLD =
20
Constants inherited
from Base
Base::CONSIDERED_YARD_TAGS
Constants included
from NodocHelper
NodocHelper::DOC_REGEX, NodocHelper::NO_DOC_ALL_REGEX, NodocHelper::NO_DOC_REGEX
Instance Attribute Summary
Attributes inherited from Base
#grade, #object
Instance Method Summary
collapse
Methods inherited from Base
#children, #depth, #docstring, #evaluation, #filename, #has_alias?, #has_code_example?, #has_doc?, #has_multiple_code_examples?, #has_unconsidered_tags?, #in_root?, #initialize, #inspect, #namespace?, #parent, #private?, #private_tag?, #protected?, #public?, #unconsidered_tags, #undocumented?
#declarations, #explicit_doc_comment?, #explicit_nodoc_all_comment?, #explicit_nodoc_comment?, #files, #get_line_no, #implicit_nodoc_all_comment?, #implicit_nodoc_comment?, #nodoc?, #nodoc_comment?
Instance Method Details
#bang_name? ⇒ Boolean
10
11
12
|
# File 'lib/inch/code_object/proxy/method_object.rb', line 10
def bang_name?
name =~ /\!$/
end
|
6
7
8
|
# File 'lib/inch/code_object/proxy/method_object.rb', line 6
def comment_and_abbrev_source
.join('') + abbrev_source
end
|
#has_many_lines? ⇒ Boolean
24
25
26
27
28
29
30
31
32
|
# File 'lib/inch/code_object/proxy/method_object.rb', line 24
def has_many_lines?
if source = object.source
size = source.lines.count
size > MANY_LINES_THRESHOLD
else
false
end
end
|
#has_many_parameters? ⇒ Boolean
19
20
21
|
# File 'lib/inch/code_object/proxy/method_object.rb', line 19
def has_many_parameters?
parameters.size > MANY_PARAMETERS_THRESHOLD
end
|
#has_parameters? ⇒ Boolean
14
15
16
|
# File 'lib/inch/code_object/proxy/method_object.rb', line 14
def has_parameters?
!parameters.empty?
end
|
#method? ⇒ Boolean
34
35
36
|
# File 'lib/inch/code_object/proxy/method_object.rb', line 34
def method?
true
end
|
#overridden? ⇒ Boolean
50
51
52
|
# File 'lib/inch/code_object/proxy/method_object.rb', line 50
def overridden?
!!object.overridden_method
end
|
#overridden_method ⇒ Object
54
55
56
|
# File 'lib/inch/code_object/proxy/method_object.rb', line 54
def overridden_method
@overridden_method ||= Proxy.for(object.overridden_method)
end
|
#parameter(name) ⇒ Object
46
47
48
|
# File 'lib/inch/code_object/proxy/method_object.rb', line 46
def parameter(name)
parameters.detect { |p| p.name == name.to_s }
end
|
#parameters ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/inch/code_object/proxy/method_object.rb', line 38
def parameters
@parameters ||= all_parameter_names.map do |name|
in_signature = signature_parameter_names.include?(name)
tag = parameter_tag(name)
MethodParameterObject.new(self, name, tag, in_signature)
end
end
|
#questioning_name? ⇒ Boolean
66
67
68
|
# File 'lib/inch/code_object/proxy/method_object.rb', line 66
def questioning_name?
name =~ /\?$/
end
|
#return_described? ⇒ Boolean
62
63
64
|
# File 'lib/inch/code_object/proxy/method_object.rb', line 62
def return_described?
(return_tag && !return_tag.text.empty?) || docstring.describes_return?
end
|
#return_mentioned? ⇒ Boolean
58
59
60
|
# File 'lib/inch/code_object/proxy/method_object.rb', line 58
def return_mentioned?
!!return_tag || docstring.mentions_return?
end
|