Module: Interdasting::Parser

Defined in:
lib/interdasting/parser.rb

Class Method Summary collapse

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_keywordsObject



27
28
29
# File 'lib/interdasting/parser.rb', line 27

def http_keywords
  %w(GET POST PUT PATCH DELETE)
end

.keywordsObject



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_keywordsObject



31
32
33
# File 'lib/interdasting/parser.rb', line 31

def parser_keywords
  string_keywords + hash_keywords
end