Class: Inch::Language::Ruby::Provider::YARD::Docstring
- Inherits:
-
Object
- Object
- Inch::Language::Ruby::Provider::YARD::Docstring
show all
- Defined in:
- lib/inch/language/ruby/provider/yard/docstring.rb
Instance Method Summary
collapse
Constructor Details
#initialize(text) ⇒ Docstring
Returns a new instance of Docstring.
7
8
9
|
# File 'lib/inch/language/ruby/provider/yard/docstring.rb', line 7
def initialize(text)
@text = text.to_s
end
|
Instance Method Details
#code_examples ⇒ Object
27
28
29
|
# File 'lib/inch/language/ruby/provider/yard/docstring.rb', line 27
def code_examples
@code_examples ||= parse_code_examples
end
|
#contains_code_example? ⇒ Boolean
23
24
25
|
# File 'lib/inch/language/ruby/provider/yard/docstring.rb', line 23
def contains_code_example?
!code_examples.empty?
end
|
#describes_internal_api? ⇒ Boolean
11
12
13
|
# File 'lib/inch/language/ruby/provider/yard/docstring.rb', line 11
def describes_internal_api?
first_line =~ /^Internal\:\ .+/
end
|
#describes_parameter?(name) ⇒ Boolean
31
32
33
34
35
36
|
# File 'lib/inch/language/ruby/provider/yard/docstring.rb', line 31
def describes_parameter?(name)
return false if name.nil?
describe_parameter_regexps(name).any? do |pattern|
@text.index(pattern)
end
end
|
#describes_private_object? ⇒ Boolean
15
16
17
|
# File 'lib/inch/language/ruby/provider/yard/docstring.rb', line 15
def describes_private_object?
first_line =~ /^Private\:\ .+/
end
|
#describes_return? ⇒ Boolean
51
52
53
54
55
56
|
# File 'lib/inch/language/ruby/provider/yard/docstring.rb', line 51
def describes_return?
last_lines.any? do |line|
line =~ /^#{tomdoc_modifiers}(Returns|Gets|Sets|Gets\/Sets)\ (\w+\s){2,}/i ||
line =~ /^#{tomdoc_modifiers}(Returns|Gets|Sets|Gets\/Sets)\ (nil|nothing)\.*/i
end
end
|
#empty? ⇒ Boolean
19
20
21
|
# File 'lib/inch/language/ruby/provider/yard/docstring.rb', line 19
def empty?
@text.strip.empty?
end
|
#mentions_parameter?(name) ⇒ Boolean
38
39
40
41
42
43
|
# File 'lib/inch/language/ruby/provider/yard/docstring.rb', line 38
def mentions_parameter?(name)
return false if name.nil?
mention_parameter_regexps(name).any? do |pattern|
@text.index(pattern)
end
end
|
#mentions_return? ⇒ Boolean
45
46
47
48
49
|
# File 'lib/inch/language/ruby/provider/yard/docstring.rb', line 45
def mentions_return?
last_lines.any? do |line|
line =~ /^#{tomdoc_modifiers}(Returns|Gets|Sets|Gets\/Sets)\ /
end
end
|
58
59
60
|
# File 'lib/inch/language/ruby/provider/yard/docstring.rb', line 58
def to_s
@text
end
|