Module: Inch::CodeObject::Provider::YARD::NodocHelper
- Included in:
- Object::Base
- Defined in:
- lib/inch/code_object/provider/yard/nodoc_helper.rb
Constant Summary collapse
- NO_DOC_REGEX =
/#\s*\:nodoc\:/
- NO_DOC_ALL_REGEX =
/#\s*\:nodoc\:\s*all/
- DOC_REGEX =
/#\s*\:doc\:/
Instance Method Summary collapse
-
#declarations ⇒ Array<String>
Returns all lines in all files declaring the object.
- #explicit_doc_comment? ⇒ Boolean
- #explicit_nodoc_all_comment? ⇒ Boolean
- #explicit_nodoc_comment? ⇒ Boolean
-
#get_line_no(filename, line_number) ⇒ String
Returns a
line_number
from a file. - #implicit_nodoc_all_comment? ⇒ Boolean
- #implicit_nodoc_comment? ⇒ Boolean
-
#nodoc? ⇒ Boolean
Returns true if the code object is somehow marked not to be documented.
- #nodoc_comment? ⇒ Boolean
Instance Method Details
#declarations ⇒ Array<String>
Returns all lines in all files declaring the object
71 72 73 74 75 |
# File 'lib/inch/code_object/provider/yard/nodoc_helper.rb', line 71 def declarations @declarations ||= files.map do |f| get_line_no(f.filename, f.line_no) end end |
#explicit_doc_comment? ⇒ Boolean
32 33 34 |
# File 'lib/inch/code_object/provider/yard/nodoc_helper.rb', line 32 def explicit_doc_comment? declarations.any? { |str| str =~ DOC_REGEX } end |
#explicit_nodoc_all_comment? ⇒ Boolean
28 29 30 |
# File 'lib/inch/code_object/provider/yard/nodoc_helper.rb', line 28 def explicit_nodoc_all_comment? declarations.any? { |str| str =~ NO_DOC_ALL_REGEX } end |
#explicit_nodoc_comment? ⇒ Boolean
24 25 26 |
# File 'lib/inch/code_object/provider/yard/nodoc_helper.rb', line 24 def explicit_nodoc_comment? declarations.any? { |str| str =~ NO_DOC_REGEX } end |
#get_line_no(filename, line_number) ⇒ String
Returns a line_number
from a file
82 83 84 85 86 87 88 |
# File 'lib/inch/code_object/provider/yard/nodoc_helper.rb', line 82 def get_line_no(filename, line_number) f = File.open(filename) line_number.times{f.gets} result = $_ f.close result end |
#implicit_nodoc_all_comment? ⇒ Boolean
36 37 38 39 40 41 |
# File 'lib/inch/code_object/provider/yard/nodoc_helper.rb', line 36 def implicit_nodoc_all_comment? if parent parent.explicit_nodoc_all_comment? || parent.implicit_nodoc_all_comment? end end |
#implicit_nodoc_comment? ⇒ Boolean
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/inch/code_object/provider/yard/nodoc_helper.rb', line 43 def implicit_nodoc_comment? return false if explicit_doc_comment? if parent return false if parent.explicit_doc_comment? if namespace? if parent.explicit_nodoc_all_comment? return true else return parent.implicit_nodoc_all_comment? end else if parent.explicit_nodoc_comment? return true else return parent.implicit_nodoc_all_comment? end end end end |
#nodoc? ⇒ Boolean
Note:
Doesnot recognize “:startdoc:” and “:stopdoc:”
Returns true if the code object is somehow marked not to be documented.
12 13 14 |
# File 'lib/inch/code_object/provider/yard/nodoc_helper.rb', line 12 def nodoc? tagged_as_private? || nodoc_comment? end |
#nodoc_comment? ⇒ Boolean
20 21 22 |
# File 'lib/inch/code_object/provider/yard/nodoc_helper.rb', line 20 def nodoc_comment? explicit_nodoc_comment? || implicit_nodoc_comment? end |