Module: Interdasting::Parser
- Defined in:
- lib/interdasting/parser.rb
Class Method Summary collapse
- .comments_for_method(method_name, file_path) ⇒ Object
- .http_keywords ⇒ Object
- .keywords ⇒ Object
- .method_comments(file_path) ⇒ Object
- .parse_comments(comments) ⇒ Object
- .parser_keywords ⇒ Object
Class Method Details
.comments_for_method(method_name, file_path) ⇒ Object
4 5 6 |
# File 'lib/interdasting/parser.rb', line 4 def comments_for_method(method_name, file_path) method_comments(file_path)[method_name.to_s] end |
.http_keywords ⇒ Object
27 28 29 |
# File 'lib/interdasting/parser.rb', line 27 def http_keywords %w(GET POST PUT PATCH DELETE) end |
.keywords ⇒ Object
23 24 25 |
# File 'lib/interdasting/parser.rb', line 23 def keywords http_keywords + parser_keywords end |
.method_comments(file_path) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/interdasting/parser.rb', line 8 def method_comments(file_path) comments = {} temp_comment = [] File.read(file_path).each_line do |line| if extract_method_comment(line, comments, temp_comment) temp_comment = [] end end clean_comments(comments) end |
.parse_comments(comments) ⇒ Object
19 20 21 |
# File 'lib/interdasting/parser.rb', line 19 def parse_comments(comments) indentation_parser.read(comments, {}) end |
.parser_keywords ⇒ Object
31 32 33 |
# File 'lib/interdasting/parser.rb', line 31 def parser_keywords string_keywords + hash_keywords end |